﻿
  
    <meta http-equiv="Content-Style-Type" content="text/css" />
    
    <link rel="stylesheet" type="text/css" href="./target/target.css" />
    <!--[if IE]><script type="text/javascript" src="./target/excanvas-compiled.js"></script><![endif]-->
    <script type="text/javascript" src="./target/target.js"> </script>

  
    <div style="margin:1ex;">
      <div style="width:100%">
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 1</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-1"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:401;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:401;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-0" style="white-space:pre;"><div style="position:absolute;top:48.3004pt;left:52.1175pt;z-index:20;letter-spacing:-.001em;">Writing your first Django app, part 1</div></span><span style="white-space:pre;"><div style="position:absolute;top:87.3562pt;left:52.1175pt;z-index:24;letter-spacing:-.001em;">Let’s learn by example.</div></span><span style="white-space:pre;"><div style="position:absolute;top:110.8pt;left:52.1175pt;z-index:42;">Throughout this tutorial, we’ll walk you through the creation of a basic poll application.</div></span><span style="white-space:pre;"><div style="position:absolute;top:134.24pt;left:52.1175pt;z-index:50;">It’ll consist of two parts:</div></span><span style="white-space:pre;"><div style="position:absolute;top:157.69pt;left:71.6539pt;z-index:63;">A public site that lets people view polls and vote in them.</div></span><canvas id="_canv_1" style="position:absolute;left:61.691pt;top:162.06pt;width:3.906pt;height:3.906pt;z-index:64;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:175.27pt;left:71.6539pt;z-index:74;">An admin site that lets you add, change and delete polls.</div></span><canvas id="_canv_2" style="position:absolute;left:61.691pt;top:179.64pt;width:3.906pt;height:3.906pt;z-index:75;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:196.76pt;left:52.1175pt;z-index:94;letter-spacing:-.002em;">We’ll assume you have <span class="fmt-2">Django instal</span><span class="fmt-2">l</span><span class="fmt-2">ed</span> already. You can tell Django is installed and which</div></span><span style="white-space:pre;"><div style="position:absolute;top:210.44pt;left:52.1175pt;z-index:102;">version by running the following command:</div></span><canvas id="_canv_3" style="position:absolute;left:52.117pt;top:232.95pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-3" style="white-space:pre;"><div style="position:absolute;top:238.17pt;left:55.634pt;z-index:104;letter-spacing:-.001em;">python -c <span class="fmt-4">"import django; print(django.get_version())"</span></div></span><canvas id="_canv_4" style="position:absolute;left:52.117pt;top:233.93pt;width:458.62pt;height:18.949pt;z-index:5;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:263.57pt;left:52.1175pt;z-index:124;">If Django is installed, you should see the version of your installation. If it isn’t, you’ll get an</div></span><canvas id="_canv_5" style="position:absolute;left:52.117pt;top:252.88pt;width:458.62pt;height:1pt;z-index:7;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:277.25pt;left:52.1175pt;z-index:132;letter-spacing:-.003em;">error telling “No module named django”.</div></span><span style="white-space:pre;"><div style="position:absolute;top:300.69pt;left:52.1175pt;z-index:150;">This tutorial is written for Django 1.6 and Python 2.x. If the Django version doesn’t match,</div></span><span style="white-space:pre;"><div style="position:absolute;top:314.37pt;left:52.1175pt;z-index:163;letter-spacing:-.001em;">you can refer to the tutorial for your version of Django by using the version switcher at the</div></span><span style="white-space:pre;"><div style="position:absolute;top:328.04pt;left:52.1175pt;z-index:180;">bottom right corner of this page, or update Django to the newest version. If you are using</div></span><span style="white-space:pre;"><div style="position:absolute;top:341.72pt;left:52.1175pt;z-index:197;letter-spacing:-.001em;">Python 3.x, be aware that your code may need to differ from what is in the tutorial and you</div></span><span style="white-space:pre;"><div style="position:absolute;top:355.4pt;left:52.1175pt;z-index:214;">should continue using the tutorial only if you know what you are doing with Python 3.x.</div></span><span style="white-space:pre;"><div style="position:absolute;top:378.84pt;left:52.1175pt;z-index:235;">See <span class="fmt-2">How</span><span class="fmt-2"> to</span><span class="fmt-2"> i</span><span class="fmt-2">nstal</span><span class="fmt-2">l Django</span><span> fo</span><span>r advi</span><span>ce</span><span> on ho</span><span>w to</span><span> re</span><span>move</span><span> ol</span><span>de</span><span>r versi</span><span>ons of Django</span><span> and instal</span><span>l</span><span> a</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:392.51pt;left:52.1175pt;z-index:238;">newer one.</div></span><canvas id="_canv_6" style="position:absolute;left:52.117pt;top:415.03pt;width:457.64pt;height:1pt;z-index:9;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:424.75pt;left:100.71pt;z-index:241;">Where to get help:</div></span><span style="white-space:pre;"><div style="position:absolute;top:444.29pt;left:100.71pt;z-index:254;">If you’re having trouble going through this tutorial, please post a message to</div></span><span class="fmt-2" style="white-space:pre;"><div style="position:absolute;top:457.96pt;left:100.71pt;z-index:269;">django-users<span class="fmt-1"> or dro</span><span class="fmt-1">p by </span>#django on irc.freenode.net<span class="fmt-1"> to</span><span class="fmt-1"> chat w</span><span class="fmt-1">ith o</span><span class="fmt-1">the</span><span class="fmt-1">r Django</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:471.64pt;left:100.71pt;z-index:275;">users who might be able to help.</div></span><canvas id="_canv_7" style="position:absolute;left:53.094pt;top:416.01pt;width:456.66pt;height:76.191pt;z-index:8;" width="608.89" height="101.59">Your browser does not support the canvas tag!</canvas><span class="fmt-6" style="white-space:pre;"><div style="position:absolute;top:514.09pt;left:52.1175pt;z-index:277;">Creating a project</div></span><canvas id="_canv_8" style="position:absolute;left:509.76pt;top:415.03pt;width:1pt;height:77.168pt;z-index:10;" width="1.3333" height="102.89">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:547.83pt;left:52.1175pt;z-index:292;letter-spacing:-.002em;">If this is your first time using Django, you’ll have to take care of some initial setup. Namely,</div></span><canvas id="_canv_9" style="position:absolute;left:53.094pt;top:492.2pt;width:457.64pt;height:1pt;z-index:11;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:561.5pt;left:52.1175pt;z-index:312;">you’ll need to auto-generate some code that establishes a Django <span class="fmt-2">pro</span><span class="fmt-2">je</span><span class="fmt-2">ct</span> – a collection of</div></span><canvas id="_canv_10" style="position:absolute;left:52.117pt;top:416.01pt;width:1pt;height:77.168pt;z-index:12;" width="1.3333" height="102.89">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:575.18pt;left:52.1175pt;z-index:326;">settings for an instance of Django, including database configuration, Django-specific options</div></span><span style="white-space:pre;"><div style="position:absolute;top:588.85pt;left:52.1175pt;z-index:334;">and application-specific settings.</div></span><span style="white-space:pre;"><div style="position:absolute;top:612.3pt;left:52.1175pt;z-index:352;">From the command line, <span class="fmt-7">cd</span> into a directory where you’d like to store your code, then run</div></span><span style="white-space:pre;"><div style="position:absolute;top:626.46pt;left:52.1175pt;z-index:359;">the following command:</div></span><canvas id="_canv_11" style="position:absolute;left:52.117pt;top:648.98pt;width:458.62pt;height:1pt;z-index:14;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-8" style="white-space:pre;"><div style="position:absolute;top:654.2pt;left:55.634pt;z-index:360;letter-spacing:-.001em;">django-admin.py startproject mysite</div></span><canvas id="_canv_12" style="position:absolute;left:52.117pt;top:649.95pt;width:458.62pt;height:18.949pt;z-index:13;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:679.6pt;left:52.1175pt;z-index:382;">This will create a <span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span> directory in your current directory. If it didn’t work, see <span class="fmt-2">Pro</span><span class="fmt-2">bl</span><span class="fmt-2">ems</span></div></span><canvas id="_canv_13" style="position:absolute;left:52.117pt;top:668.91pt;width:458.62pt;height:1pt;z-index:15;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-2" style="white-space:pre;"><div style="position:absolute;top:693.76pt;left:52.1175pt;z-index:385;letter-spacing:-.004em;">running django-admin.py<span class="fmt-1">.</span></div></span><canvas id="_canv_14" style="position:absolute;left:52.117pt;top:716.28pt;width:457.64pt;height:1pt;z-index:17;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:726pt;left:100.71pt;z-index:386;">Note</div></span><canvas id="_canv_15" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_16" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:719.91pt;z-index:2;" width="720.01" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_17" style="position:absolute;left:528.32pt;top:48.773pt;width:44.934pt;height:707.15pt;z-index:3;" width="59.912" height="942.86">Your browser does not support the canvas tag!</canvas><canvas id="_canv_18" style="position:absolute;left:36pt;top:48.773pt;width:492.32pt;height:707.15pt;z-index:4;" width="656.42" height="942.86">Your browser does not support the canvas tag!</canvas><canvas id="_canv_19" style="position:absolute;left:53.094pt;top:717.26pt;width:456.66pt;height:38.656pt;z-index:16;" width="608.89" height="51.5413">Your browser does not support the canvas tag!</canvas><canvas id="_canv_20" style="position:absolute;left:509.76pt;top:716.28pt;width:1pt;height:39.719pt;z-index:18;" width="1.3333" height="52.9587">Your browser does not support the canvas tag!</canvas><canvas id="_canv_21" style="position:absolute;left:52.117pt;top:717.26pt;width:1pt;height:38.742pt;z-index:19;" width="1.3333" height="51.656">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:406;">1 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:406;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage1();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 2</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-1"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:437;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:437;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span style="white-space:pre;"><div style="position:absolute;top:42.7889pt;left:100.71pt;z-index:38;letter-spacing:-.001em;">You’ll need to avoid naming projects after built-in Python or Django components.</div></span><span style="white-space:pre;"><div style="position:absolute;top:56.4643pt;left:100.71pt;z-index:56;letter-spacing:-.002em;">In particular, this means you should avoid using names like <span class="fmt-7">dj</span><span class="fmt-7">an</span><span class="fmt-7">go</span> (which will</div></span><span style="white-space:pre;"><div style="position:absolute;top:70.6282pt;left:100.71pt;z-index:73;letter-spacing:.001em;">conflict with Django itself) or <span class="fmt-7">te</span><span class="fmt-7">st</span> (which conflicts with a built-in Python</div></span><span style="white-space:pre;"><div style="position:absolute;top:84.7921pt;left:100.71pt;z-index:75;">package).</div></span><canvas id="_canv_22" style="position:absolute;left:53.094pt;top:36pt;width:456.66pt;height:69.355pt;z-index:5;" width="608.89" height="92.4733">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:125.82pt;left:100.71pt;z-index:78;">Where should this code live?</div></span><canvas id="_canv_23" style="position:absolute;left:509.76pt;top:36pt;width:1pt;height:69.355pt;z-index:6;" width="1.3333" height="92.4733">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:145.35pt;left:100.71pt;z-index:92;">If your background is in plain old PHP (with no use of modern frameworks),</div></span><canvas id="_canv_24" style="position:absolute;left:53.094pt;top:105.35pt;width:457.64pt;height:1pt;z-index:7;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:159.03pt;left:100.71pt;z-index:105;letter-spacing:-.001em;">you’re probably used to putting code under the Web server’s document root (in</div></span><canvas id="_canv_25" style="position:absolute;left:52.117pt;top:36pt;width:1pt;height:70.332pt;z-index:8;" width="1.3333" height="93.776">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:172.71pt;left:100.71pt;z-index:120;">a place such as <span class="fmt-7">/v</span><span class="fmt-7">ar</span><span class="fmt-7">/w</span><span class="fmt-7">ww</span><span>). Wi</span><span>th Django, yo</span><span>u don’</span><span>t do</span><span> that. It</span><span>’s no</span><span>t a go</span><span>od i</span><span>de</span><span>a</span></div></span><canvas id="_canv_26" style="position:absolute;left:52.117pt;top:116.1pt;width:457.64pt;height:1pt;z-index:10;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:186.87pt;left:100.71pt;z-index:134;letter-spacing:-.001em;">to put any of this Python code within your Web server’s document root, because</div></span><span style="white-space:pre;"><div style="position:absolute;top:200.55pt;left:100.71pt;z-index:149;letter-spacing:-.001em;">it risks the possibility that people may be able to view your code over the Web.</div></span><span style="white-space:pre;"><div style="position:absolute;top:214.22pt;left:100.71pt;z-index:155;letter-spacing:-.004em;">That’s not good for security.</div></span><span style="white-space:pre;"><div style="position:absolute;top:237.66pt;left:100.71pt;z-index:169;">Put your code in some directory <span class="fmt-10">outside</span> of the document root, such as</div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:252.09pt;left:100.71pt;z-index:176;">/home/mycode<span class="fmt-1">.</span></div></span><canvas id="_canv_27" style="position:absolute;left:53.094pt;top:117.07pt;width:456.66pt;height:155.31pt;z-index:9;" width="608.89" height="207.08">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:284.06pt;left:52.1175pt;z-index:188;"><span class="fmt-1">Let</span><span class="fmt-1">’s l</span><span class="fmt-1">oo</span><span class="fmt-1">k at what </span>startproject<span class="fmt-12"> created:</span></div></span><canvas id="_canv_28" style="position:absolute;left:509.76pt;top:116.1pt;width:1pt;height:156.29pt;z-index:11;" width="1.3333" height="208.39">Your browser does not support the canvas tag!</canvas><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:312.29pt;left:55.634pt;z-index:189;letter-spacing:-.001em;">mysite/</div></span><canvas id="_canv_29" style="position:absolute;left:53.094pt;top:272.39pt;width:457.64pt;height:1pt;z-index:12;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_30" style="position:absolute;left:52.117pt;top:117.07pt;width:1pt;height:156.29pt;z-index:13;" width="1.3333" height="208.39">Your browser does not support the canvas tag!</canvas><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:325.97pt;left:55.634pt;z-index:190;letter-spacing:-.001em;">    manage.py</div></span><canvas id="_canv_31" style="position:absolute;left:52.117pt;top:307.07pt;width:458.62pt;height:1pt;z-index:15;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:339.64pt;left:55.634pt;z-index:191;letter-spacing:-.001em;">    mysite/</div></span><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:353.32pt;left:55.634pt;z-index:192;letter-spacing:-.001em;">        __init__.py</div></span><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:366.99pt;left:55.634pt;z-index:193;letter-spacing:-.001em;">        settings.py</div></span><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:380.67pt;left:55.634pt;z-index:194;letter-spacing:-.001em;">        urls.py</div></span><span class="fmt-13" style="white-space:pre;"><div style="position:absolute;top:394.34pt;left:55.634pt;z-index:195;letter-spacing:-.001em;">        wsgi.py</div></span><canvas id="_canv_32" style="position:absolute;left:52.117pt;top:308.04pt;width:458.62pt;height:101pt;z-index:14;" width="611.49" height="134.67">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:429.51pt;left:100.71pt;z-index:198;">Doesn’t match what you see?</div></span><canvas id="_canv_33" style="position:absolute;left:52.117pt;top:409.05pt;width:458.62pt;height:1pt;z-index:16;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:449.05pt;left:100.71pt;z-index:213;">The default project layout recently changed. If you’re seeing a “flat” layout (with</div></span><canvas id="_canv_34" style="position:absolute;left:52.117pt;top:419.79pt;width:457.64pt;height:1pt;z-index:18;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:462.72pt;left:100.71pt;z-index:231;">no inner <span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span><span class="fmt-7">/</span> directory), you’re probably using a version of Django that</div></span><span style="white-space:pre;"><div style="position:absolute;top:476.89pt;left:100.71pt;z-index:247;letter-spacing:-.001em;">doesn’t match this tutorial version. You’ll want to either switch to the older</div></span><span style="white-space:pre;"><div style="position:absolute;top:490.56pt;left:100.71pt;z-index:255;">tutorial or the newer Django version.</div></span><canvas id="_canv_35" style="position:absolute;left:53.094pt;top:420.77pt;width:456.66pt;height:90.355pt;z-index:17;" width="608.89" height="120.47">Your browser does not support the canvas tag!</canvas><canvas id="_canv_36" style="position:absolute;left:141.36pt;top:296.32pt;width:72.5746pt;height:1.9536pt;z-index:181;" width="96.7662" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:522.8pt;left:52.1175pt;z-index:260;">These files are:</div></span><canvas id="_canv_37" style="position:absolute;left:509.76pt;top:419.79pt;width:1pt;height:91.332pt;z-index:19;" width="1.3333" height="121.78">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:546.24pt;left:71.6539pt;z-index:277;">The outer <span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span><span class="fmt-7">/</span> root directory is just a container for your project. Its name doesn’t</div></span><canvas id="_canv_38" style="position:absolute;left:53.094pt;top:511.13pt;width:457.64pt;height:1pt;z-index:20;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:560.4pt;left:71.6539pt;z-index:285;letter-spacing:-.001em;">matter to Django; you can rename it to anything you like.</div></span><canvas id="_canv_39" style="position:absolute;left:52.117pt;top:420.77pt;width:1pt;height:91.332pt;z-index:21;" width="1.3333" height="121.78">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:578.74pt;left:71.6539pt;z-index:301;"><span class="fmt-7">ma</span><span class="fmt-7">na</span><span class="fmt-7">ge</span><span class="fmt-7">.p</span><span class="fmt-7">y</span>: A command-line utility that lets you interact with this Django project in</div></span><canvas id="_canv_40" style="position:absolute;left:61.691pt;top:550.61pt;width:3.906pt;height:3.906pt;z-index:286;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:592.15pt;left:71.6539pt;z-index:316;letter-spacing:-.001em;">various ways. You can read all the details about <span class="fmt-7">ma</span><span class="fmt-7">na</span><span class="fmt-7">ge</span><span class="fmt-7">.p</span><span class="fmt-7">y</span> in <span class="fmt-2">django-admin.py and</span></div></span><canvas id="_canv_41" style="position:absolute;left:61.691pt;top:582.36pt;width:3.906pt;height:3.906pt;z-index:319;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-2" style="white-space:pre;"><div style="position:absolute;top:606.32pt;left:71.6539pt;z-index:318;letter-spacing:-.009em;">manage.py<span class="fmt-1">.</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:623.9pt;left:71.6539pt;z-index:334;">The inner <span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span><span class="fmt-7">/</span> directory is the actual Python package for your project. Its name is</div></span><canvas id="_canv_42" style="position:absolute;left:61.691pt;top:628.27pt;width:3.906pt;height:3.906pt;z-index:356;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:638.06pt;left:71.6539pt;z-index:349;">the Python package name you’ll need to use to import anything inside it (e.g.</div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:652.49pt;left:71.6539pt;z-index:355;">mysite.urls<span class="fmt-1">).</span></div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:670.56pt;left:71.6539pt;z-index:374;">mysite/__init__.py<span class="fmt-1">: An empty fi</span><span class="fmt-1">le</span><span class="fmt-1"> that tel</span><span class="fmt-1">ls</span><span class="fmt-1"> Python that thi</span><span class="fmt-1">s di</span><span class="fmt-1">re</span><span class="fmt-1">ctory shoul</span><span class="fmt-1">d be</span></div></span><canvas id="_canv_43" style="position:absolute;left:61.691pt;top:674.18pt;width:3.906pt;height:3.906pt;z-index:391;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:683.97pt;left:71.6539pt;z-index:388;">considered a Python package. (Read <span class="fmt-2">more abo</span><span class="fmt-2">ut package</span><span class="fmt-2">s</span> in the official Python docs if</div></span><span style="white-space:pre;"><div style="position:absolute;top:697.65pt;left:71.6539pt;z-index:390;letter-spacing:-.006em;">you’re a Python beginner.)</div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:715.98pt;left:71.6539pt;z-index:412;">mysite/settings.py<span class="fmt-1">: Se</span><span class="fmt-1">tti</span><span class="fmt-1">ngs/co</span><span class="fmt-1">nfi</span><span class="fmt-1">gurati</span><span class="fmt-1">on fo</span><span class="fmt-1">r thi</span><span class="fmt-1">s Django projec</span><span class="fmt-1">t. </span><span class="fmt-2">Django se</span><span class="fmt-2">tti</span><span class="fmt-2">ngs</span></div></span><canvas id="_canv_44" style="position:absolute;left:61.691pt;top:719.6pt;width:3.906pt;height:3.906pt;z-index:422;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:729.39pt;left:71.6539pt;z-index:421;">will tell you all about how settings work.</div></span><canvas id="_canv_45" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_46" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_47" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_48" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:442;">2 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:442;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage2();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 3</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-1"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:407;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:407;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span style="white-space:pre;"><div style="position:absolute;top:37.6801pt;left:71.6539pt;z-index:45;"><span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span><span class="fmt-7">/u</span><span class="fmt-7">rls</span><span class="fmt-7">.p</span><span class="fmt-7">y</span>: The URL declarations for this Django project; a “table of contents” of</div></span><canvas id="_canv_49" style="position:absolute;left:61.691pt;top:41.301pt;width:3.906pt;height:3.906pt;z-index:62;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:51.0919pt;left:71.6539pt;z-index:61;letter-spacing:-.002em;">your Django-powered site. You can read more about URLs in <span class="fmt-2">U</span><span class="fmt-2">RL di</span><span class="fmt-2">spatc</span><span class="fmt-2">he</span><span class="fmt-2">r</span>.</div></span><canvas id="_canv_50" style="position:absolute;left:228.48pt;top:723.39pt;width:54.9226pt;height:1.9536pt;z-index:371;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:69.4267pt;left:71.6539pt;z-index:75;letter-spacing:-.001em;">mysite/wsgi.py<span class="fmt-1">: An entry-po</span><span class="fmt-1">int fo</span><span class="fmt-1">r WSGI-compatible</span><span class="fmt-1"> we</span><span class="fmt-1">b servers to</span><span class="fmt-1"> serve your</span></div></span><canvas id="_canv_51" style="position:absolute;left:61.691pt;top:73.047pt;width:3.906pt;height:3.906pt;z-index:91;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:82.8384pt;left:71.6539pt;z-index:90;">project. See <span class="fmt-2">How</span><span class="fmt-2"> to</span><span class="fmt-2"> deploy</span><span class="fmt-2"> wi</span><span class="fmt-2">th WSGI</span> for more details.</div></span><canvas id="_canv_52" style="position:absolute;left:382pt;top:681.87pt;width:54.9217pt;height:1.9536pt;z-index:363;" width="73.2289" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-14" style="white-space:pre;"><div style="position:absolute;top:112.45pt;left:52.1175pt;z-index:96;">The development server</div></span><span style="white-space:pre;"><div style="position:absolute;top:140.47pt;left:52.1175pt;z-index:110;letter-spacing:-.002em;">Let’s verify this worked. Change into the outer <span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span> directory, if you haven’t already, and</div></span><span style="white-space:pre;"><div style="position:absolute;top:154.63pt;left:52.1175pt;z-index:134;letter-spacing:-.001em;">run the command <span class="fmt-7">py</span><span class="fmt-7">th</span><span class="fmt-7">on</span> <span class="fmt-7">m</span><span class="fmt-7">an</span><span class="fmt-7">age</span><span class="fmt-7">.p</span><span class="fmt-7">y</span> <span class="fmt-7">ru</span><span class="fmt-7">ns</span><span class="fmt-7">erv</span><span class="fmt-7">er</span>. You’ll see the following output on the</div></span><span style="white-space:pre;"><div style="position:absolute;top:168.8pt;left:52.1175pt;z-index:137;">command line:</div></span><canvas id="_canv_53" style="position:absolute;left:52.117pt;top:191.31pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-15" style="white-space:pre;"><div style="position:absolute;top:196.54pt;left:55.634pt;z-index:138;letter-spacing:-.001em;">Validating models...</div></span><span class="fmt-15" style="white-space:pre;"><div style="position:absolute;top:223.89pt;left:55.634pt;z-index:139;letter-spacing:-.001em;">0 errors found</div></span><span class="fmt-15" style="white-space:pre;"><div style="position:absolute;top:237.56pt;left:55.634pt;z-index:140;letter-spacing:-.001em;">May 16, 2014 - 15:50:53</div></span><span class="fmt-15" style="white-space:pre;"><div style="position:absolute;top:251.24pt;left:55.634pt;z-index:141;letter-spacing:-.001em;">Django version 1.6, using settings 'mysite.settings'</div></span><span class="fmt-15" style="white-space:pre;"><div style="position:absolute;top:264.92pt;left:55.634pt;z-index:143;letter-spacing:-.001em;">Starting development server at <span class="fmt-16">http://127.0.0.1:8000/</span></div></span><span class="fmt-15" style="white-space:pre;"><div style="position:absolute;top:278.59pt;left:55.634pt;z-index:144;letter-spacing:-.001em;">Quit the server with CONTROL-C.</div></span><canvas id="_canv_54" style="position:absolute;left:52.117pt;top:192.29pt;width:458.62pt;height:101pt;z-index:5;" width="611.49" height="134.67">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:303.99pt;left:52.1175pt;z-index:163;letter-spacing:-.003em;">You’ve started the Django development server, a lightweight Web server written purely in</div></span><canvas id="_canv_55" style="position:absolute;left:52.117pt;top:293.29pt;width:458.62pt;height:1pt;z-index:7;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_56" style="position:absolute;left:175.81pt;top:496.96pt;width:54.9186pt;height:1.9536pt;z-index:271;" width="73.2248" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:317.67pt;left:52.1175pt;z-index:177;letter-spacing:-.002em;">Python. We’ve included this with Django so you can develop things rapidly, without having to</div></span><span style="white-space:pre;"><div style="position:absolute;top:331.34pt;left:52.1175pt;z-index:189;">deal with configuring a production server – such as Apache – until you’re ready for</div></span><span style="white-space:pre;"><div style="position:absolute;top:345.02pt;left:52.1175pt;z-index:192;">production.</div></span><span style="white-space:pre;"><div style="position:absolute;top:368.46pt;left:52.1175pt;z-index:208;letter-spacing:-.001em;">Now’s a good time to note: <span class="fmt-10">Don’t</span> use this server in anything resembling a production</div></span><span style="white-space:pre;"><div style="position:absolute;top:382.14pt;left:52.1175pt;z-index:230;letter-spacing:-.001em;">environment. It’s intended only for use while developing. (We’re in the business of making</div></span><span style="white-space:pre;"><div style="position:absolute;top:395.81pt;left:52.1175pt;z-index:236;letter-spacing:-.004em;">Web frameworks, not Web servers.)</div></span><span style="white-space:pre;"><div style="position:absolute;top:419.25pt;left:52.1175pt;z-index:254;letter-spacing:-.003em;">Now that the server’s running, visit <span class="fmt-2">http://1</span><span class="fmt-2">2</span><span class="fmt-2">7.0</span><span class="fmt-2">.0</span><span class="fmt-2">.1:8</span><span class="fmt-2">00</span><span class="fmt-2">0/</span><span> wi</span><span>th yo</span><span>ur Web bro</span><span>ws</span><span>er. You’</span><span>ll</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:432.93pt;left:52.1175pt;z-index:266;letter-spacing:-.001em;">see a “Welcome to Django” page, in pleasant, light-blue pastel. It worked!</div></span><canvas id="_canv_57" style="position:absolute;left:52.117pt;top:455.45pt;width:457.64pt;height:1pt;z-index:9;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:465.17pt;left:100.71pt;z-index:267;">Changing the port</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:484.7pt;left:100.71pt;z-index:285;"><span class="fmt-1">By de</span><span class="fmt-1">faul</span><span class="fmt-1">t, the </span><span class="fmt-11">ru</span><span class="fmt-11">ns</span><span class="fmt-11">er</span><span class="fmt-11">ve</span><span class="fmt-11">r</span> command starts the development server on the</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:498.87pt;left:100.71pt;z-index:293;">internal IP at port 8000.</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:522.31pt;left:100.71pt;z-index:307;letter-spacing:-.001em;">If you want to change the server’s port, pass it as a command-line argument.</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:535.98pt;left:100.71pt;z-index:318;letter-spacing:-.001em;">For instance, this command starts the server on port 8080:</div></span><canvas id="_canv_58" style="position:absolute;left:100.71pt;top:558.5pt;width:399.27pt;height:1pt;z-index:14;" width="532.36" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-17" style="white-space:pre;"><div style="position:absolute;top:563.72pt;left:104.23pt;z-index:320;letter-spacing:-.001em;">$ <span class="fmt-18">python manage.py runserver 8080</span></div></span><canvas id="_canv_59" style="position:absolute;left:100.71pt;top:559.48pt;width:399.27pt;height:18.949pt;z-index:13;" width="532.36" height="25.2653">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:589.12pt;left:100.71pt;z-index:335;letter-spacing:-.002em;">If you want to change the server’s IP, pass it along with the port. So to listen on</div></span><canvas id="_canv_60" style="position:absolute;left:100.71pt;top:578.43pt;width:399.27pt;height:1pt;z-index:15;" width="532.36" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:602.8pt;left:100.71pt;z-index:352;">all public IPs (useful if you want to show off your work on other computers),</div></span><span style="white-space:pre;"><div style="position:absolute;top:616.47pt;left:100.71pt;z-index:353;">use:</div></span><canvas id="_canv_61" style="position:absolute;left:100.71pt;top:638.99pt;width:399.27pt;height:1pt;z-index:17;" width="532.36" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-19" style="white-space:pre;"><div style="position:absolute;top:644.21pt;left:104.23pt;z-index:355;letter-spacing:-.001em;">$ <span class="fmt-20">python manage.py runserver 0.0.0.0:8000</span></div></span><canvas id="_canv_62" style="position:absolute;left:100.71pt;top:639.96pt;width:399.27pt;height:18.949pt;z-index:16;" width="532.36" height="25.2653">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:669.61pt;left:100.71pt;z-index:369;letter-spacing:-.003em;">Full docs for the development server can be found in the <span class="fmt-11">ru</span><span class="fmt-11">ns</span><span class="fmt-11">er</span><span class="fmt-11">ve</span><span class="fmt-11">r</span><span class="fmt-12"> reference.</span></div></span><canvas id="_canv_63" style="position:absolute;left:53.094pt;top:456.42pt;width:456.66pt;height:234.24pt;z-index:8;" width="608.89" height="312.32">Your browser does not support the canvas tag!</canvas><canvas id="_canv_64" style="position:absolute;left:100.71pt;top:658.92pt;width:399.27pt;height:1pt;z-index:18;" width="532.36" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-22" style="white-space:pre;"><div style="position:absolute;top:711.13pt;left:100.71pt;z-index:376;letter-spacing:-.008em;"><span class="fmt-21">Automatic reloading of</span> runserver</div></span><canvas id="_canv_65" style="position:absolute;left:509.76pt;top:455.45pt;width:1pt;height:235.22pt;z-index:10;" width="1.3333" height="313.63">Your browser does not support the canvas tag!</canvas><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:731.15pt;left:100.71pt;z-index:392;">The development server automatically reloads Python code for each request as</div></span><canvas id="_canv_66" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_67" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_68" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_69" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_70" style="position:absolute;left:53.094pt;top:690.66pt;width:457.64pt;height:1pt;z-index:11;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_71" style="position:absolute;left:52.117pt;top:456.42pt;width:1pt;height:235.22pt;z-index:12;" width="1.3333" height="313.63">Your browser does not support the canvas tag!</canvas><canvas id="_canv_72" style="position:absolute;left:53.094pt;top:702.39pt;width:456.66pt;height:53.531pt;z-index:19;" width="608.89" height="71.3747">Your browser does not support the canvas tag!</canvas><canvas id="_canv_73" style="position:absolute;left:52.117pt;top:701.41pt;width:457.64pt;height:1pt;z-index:20;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_74" style="position:absolute;left:509.76pt;top:701.41pt;width:1pt;height:54.594pt;z-index:21;" width="1.3333" height="72.792">Your browser does not support the canvas tag!</canvas><canvas id="_canv_75" style="position:absolute;left:52.117pt;top:702.39pt;width:1pt;height:53.613pt;z-index:22;" width="1.3333" height="71.484">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:412;">3 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:412;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage3();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 4</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-12"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:664;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:664;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:36.928pt;left:100.71pt;z-index:27;letter-spacing:-.001em;">needed. You don’t need to restart the server for code changes to take effect.</div></span><canvas id="_canv_76" style="position:absolute;left:70.6752pt;top:746.15pt;width:154.97pt;height:1.9536pt;z-index:629;" width="206.63" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:50.6034pt;left:100.71pt;z-index:46;letter-spacing:-.002em;">However, some actions like adding files or compiling translation files don’t</div></span><canvas id="_canv_77" style="position:absolute;left:70.6752pt;top:728.07pt;width:137.32pt;height:1.9536pt;z-index:612;" width="183.09" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:64.2789pt;left:100.71pt;z-index:58;letter-spacing:-.001em;">trigger a restart, so you’ll have to restart the server in these cases.</div></span><canvas id="_canv_78" style="position:absolute;left:53.094pt;top:36pt;width:456.66pt;height:48.84pt;z-index:5;" width="608.89" height="65.12">Your browser does not support the canvas tag!</canvas><canvas id="_canv_79" style="position:absolute;left:70.6752pt;top:710pt;width:137.32pt;height:1.9536pt;z-index:595;" width="183.09" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-14" style="white-space:pre;"><div style="position:absolute;top:102.68pt;left:52.1175pt;z-index:62;">Database setup</div></span><canvas id="_canv_80" style="position:absolute;left:509.76pt;top:36pt;width:1pt;height:48.84pt;z-index:6;" width="1.3333" height="65.12">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:130.7pt;left:52.1175pt;z-index:86;letter-spacing:-.001em;">Now, edit <span class="fmt-7">my</span><span class="fmt-7">si</span><span class="fmt-7">te</span><span class="fmt-7">/s</span><span class="fmt-7">ett</span><span class="fmt-7">in</span><span class="fmt-7">gs</span><span class="fmt-7">.p</span><span class="fmt-7">y</span>. It’s a normal Python module with module-level variables</div></span><canvas id="_canv_81" style="position:absolute;left:53.094pt;top:84.84pt;width:457.64pt;height:1pt;z-index:7;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_82" style="position:absolute;left:52.117pt;top:36pt;width:1pt;height:49.816pt;z-index:8;" width="1.3333" height="66.4213">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:144.87pt;left:52.1175pt;z-index:91;">representing Django settings.</div></span><canvas id="_canv_83" style="position:absolute;left:107.93pt;top:631.86pt;width:84.3486pt;height:1.9536pt;z-index:515;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_84" style="position:absolute;left:70.6752pt;top:655.79pt;width:119.66pt;height:1.9536pt;z-index:538;" width="159.55" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_85" style="position:absolute;left:70.6752pt;top:673.86pt;width:113.78pt;height:1.9536pt;z-index:559;" width="151.7" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_86" style="position:absolute;left:70.6752pt;top:691.93pt;width:160.86pt;height:1.9536pt;z-index:575;" width="214.48" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:168.31pt;left:52.1175pt;z-index:109;">By default, the configuration uses SQLite. If you’re new to databases, or you’re just</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:181.99pt;left:52.1175pt;z-index:128;">interested in trying Django, this is the easiest choice. SQLite is included in Python, so you</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:195.66pt;left:52.1175pt;z-index:138;">won’t need to install anything else to support your database.</div></span><canvas id="_canv_87" style="position:absolute;left:122.86pt;top:580.58pt;width:84.3476pt;height:1.9536pt;z-index:469;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:219.1pt;left:52.1175pt;z-index:152;">If you wish to use another database, install the appropriate <span class="fmt-2">database</span><span class="fmt-2"> bindings</span><span>, and change</span></div></span><canvas id="_canv_88" style="position:absolute;left:283.38pt;top:556.64pt;width:54.9226pt;height:1.9536pt;z-index:456;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:232.78pt;left:52.1175pt;z-index:177;letter-spacing:-.006em;"><span class="fmt-1">the</span><span class="fmt-1"> fo</span><span class="fmt-1">ll</span><span class="fmt-1">o</span><span class="fmt-1">wi</span><span class="fmt-1">ng ke</span><span class="fmt-1">ys i</span><span class="fmt-1">n the</span> DATABASES 'default'<span class="fmt-12"> ite</span><span class="fmt-12">m to match yo</span><span class="fmt-12">ur database co</span><span class="fmt-12">nne</span><span class="fmt-12">ctio</span><span class="fmt-12">n</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:246.94pt;left:52.1175pt;z-index:178;">settings:</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:271.14pt;left:71.6539pt;z-index:197;">ENGINE<span class="fmt-12"> – Either </span>'django.db.backends.sqlite3'<span class="fmt-12">,</span></div></span><canvas id="_canv_89" style="position:absolute;left:61.691pt;top:274.76pt;width:3.906pt;height:3.906pt;z-index:256;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:285.3pt;left:71.6539pt;z-index:230;">'django.db.backends.postgresql_psycopg2'<span class="fmt-12">, </span>'django.db.backends.mysql'<span class="fmt-12">, or</span></div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:299.47pt;left:71.6539pt;z-index:255;">'django.db.backends.oracle'<span class="fmt-12">. Othe</span><span class="fmt-12">r backe</span><span class="fmt-12">nds are </span>also available<span class="fmt-12">.</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:317.54pt;left:71.6539pt;z-index:271;"><span class="fmt-11">NA</span><span class="fmt-11">ME</span> – The name of your database. If you’re using SQLite, the database will be a file on</div></span><canvas id="_canv_90" style="position:absolute;left:61.691pt;top:321.16pt;width:3.906pt;height:3.906pt;z-index:323;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:330.95pt;left:71.6539pt;z-index:288;">your computer; in that case, <span class="fmt-11">NA</span><span class="fmt-11">ME</span> should be the full absolute path, including filename,</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:345.11pt;left:71.6539pt;z-index:315;"><span class="fmt-12">o</span><span class="fmt-12">f that fil</span><span class="fmt-12">e</span><span class="fmt-12">. The defaul</span><span class="fmt-12">t val</span><span class="fmt-12">ue, </span>os.path.join(BASE_DIR, 'db.sqlite3')<span class="fmt-12">, wi</span><span class="fmt-12">ll</span><span class="fmt-12"> sto</span><span class="fmt-12">re the</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:359.28pt;left:71.6539pt;z-index:322;letter-spacing:-.003em;">file in your project directory.</div></span><span style="white-space:pre;"><div style="position:absolute;top:380.77pt;left:52.1175pt;z-index:344;">If you are not using SQLite as your database, additional settings such as <span class="fmt-11">US</span><span class="fmt-11">ER</span>, <span class="fmt-11">PA</span><span class="fmt-11">SS</span><span class="fmt-11">WO</span><span class="fmt-11">RD</span>,</div></span><canvas id="_canv_91" style="position:absolute;left:51.1402pt;top:407.19pt;width:25.4966pt;height:1.9536pt;z-index:345;" width="33.9955" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:395.68pt;left:52.1175pt;z-index:367;"><span class="fmt-11">HO</span><span class="fmt-11">ST</span> must be added. For more details, see the reference documentation for <span class="fmt-11">DA</span><span class="fmt-11">TA</span><span class="fmt-11">BA</span><span class="fmt-11">SE</span><span class="fmt-11">S</span>.</div></span><canvas id="_canv_92" style="position:absolute;left:52.117pt;top:417.94pt;width:457.64pt;height:1pt;z-index:10;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_93" style="position:absolute;left:412.3pt;top:393.03pt;width:25.4936pt;height:1.9536pt;z-index:335;" width="33.9915" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_94" style="position:absolute;left:427.96pt;top:407.19pt;width:54.9217pt;height:1.9536pt;z-index:361;" width="73.2289" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-21" style="white-space:pre;"><div style="position:absolute;top:427.66pt;left:100.71pt;z-index:368;">Note</div></span><canvas id="_canv_95" style="position:absolute;left:214.87pt;top:343.21pt;width:25.4966pt;height:1.9536pt;z-index:276;" width="33.9955" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_96" style="position:absolute;left:442.82pt;top:393.03pt;width:49.0356pt;height:1.9536pt;z-index:339;" width="65.3808" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:447.19pt;left:100.71pt;z-index:381;letter-spacing:-.001em;">If you’re using PostgreSQL or MySQL, make sure you’ve created a database by</div></span><canvas id="_canv_97" style="position:absolute;left:70.6752pt;top:329.05pt;width:25.4966pt;height:1.9536pt;z-index:257;" width="33.9955" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:460.87pt;left:100.71pt;z-index:404;"><span class="fmt-12">thi</span><span class="fmt-12">s po</span><span class="fmt-12">i</span><span class="fmt-12">nt. Do</span><span class="fmt-12"> that wi</span><span class="fmt-12">th “</span>CREATE DATABASE database_name;<span class="fmt-12">” w</span><span class="fmt-12">ithin yo</span><span class="fmt-12">ur</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:475.03pt;left:100.71pt;z-index:408;letter-spacing:-.002em;">database’s interactive prompt.</div></span><canvas id="_canv_98" style="position:absolute;left:336.31pt;top:310.97pt;width:84.3486pt;height:1.9536pt;z-index:247;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:498.47pt;left:100.71pt;z-index:426;">If you’re using SQLite, you don’t need to create anything beforehand - the</div></span><canvas id="_canv_99" style="position:absolute;left:70.6752pt;top:282.65pt;width:37.2666pt;height:1.9536pt;z-index:179;" width="49.6888" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:512.15pt;left:100.71pt;z-index:440;">database file will be created automatically when it is needed.</div></span><canvas id="_canv_100" style="position:absolute;left:53.094pt;top:418.91pt;width:456.66pt;height:113.8pt;z-index:9;" width="608.89" height="151.73">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:544.39pt;left:52.1175pt;z-index:465;"><span class="fmt-12">Whil</span><span class="fmt-12">e you’re e</span><span class="fmt-12">di</span><span class="fmt-12">ti</span><span class="fmt-12">ng </span>mysite/settings.py<span class="fmt-12">, set </span>TIME_ZONE<span class="fmt-12"> to</span><span class="fmt-12"> yo</span><span class="fmt-12">ur ti</span><span class="fmt-12">me zone.</span></div></span><canvas id="_canv_101" style="position:absolute;left:509.76pt;top:417.94pt;width:1pt;height:114.78pt;z-index:11;" width="1.3333" height="153.04">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:568.32pt;left:52.1175pt;z-index:485;">Also, note the <span class="fmt-11">IN</span><span class="fmt-11">ST</span><span class="fmt-11">AL</span><span class="fmt-11">LE</span><span class="fmt-11">D_A</span><span class="fmt-11">PP</span><span class="fmt-11">S</span> setting at the top of the file. That holds the names of all</div></span><canvas id="_canv_102" style="position:absolute;left:53.094pt;top:532.71pt;width:457.64pt;height:1pt;z-index:12;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:582.48pt;left:52.1175pt;z-index:499;">Django applications that are activated in this Django instance. Apps can be used in multiple</div></span><canvas id="_canv_103" style="position:absolute;left:52.117pt;top:418.91pt;width:1pt;height:114.78pt;z-index:13;" width="1.3333" height="153.04">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:596.16pt;left:52.1175pt;z-index:511;">projects, and you can package and distribute them for use by others in their projects.</div></span><canvas id="_canv_104" style="position:absolute;left:174.86pt;top:245.04pt;width:54.9226pt;height:1.9536pt;z-index:161;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:619.6pt;left:52.1175pt;z-index:537;">By default, <span class="fmt-11">IN</span><span class="fmt-11">ST</span><span class="fmt-11">AL</span><span class="fmt-11">LE</span><span class="fmt-11">D_A</span><span class="fmt-11">PP</span><span class="fmt-11">S</span> contains the following apps, all of which come with Django:</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:644.28pt;left:71.6539pt;z-index:557;">django.contrib.admin<span class="fmt-12"> – The admin site</span><span class="fmt-12">. You’ll</span><span class="fmt-12"> us</span><span class="fmt-12">e it in </span><span class="fmt-23">part 2 o</span><span class="fmt-23">f thi</span><span class="fmt-23">s tutori</span><span class="fmt-23">al</span><span class="fmt-12">.</span></div></span><canvas id="_canv_105" style="position:absolute;left:61.691pt;top:647.9pt;width:3.906pt;height:3.906pt;z-index:558;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:662.36pt;left:71.6539pt;z-index:573;">django.contrib.auth<span class="fmt-12"> – An authentic</span><span class="fmt-12">atio</span><span class="fmt-12">n s</span><span class="fmt-12">yste</span><span class="fmt-12">m.</span></div></span><canvas id="_canv_106" style="position:absolute;left:61.691pt;top:665.97pt;width:3.906pt;height:3.906pt;z-index:574;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:680.43pt;left:71.6539pt;z-index:593;">django.contrib.contenttypes<span class="fmt-12"> – A framew</span><span class="fmt-12">ork fo</span><span class="fmt-12">r co</span><span class="fmt-12">nte</span><span class="fmt-12">nt types.</span></div></span><canvas id="_canv_107" style="position:absolute;left:61.691pt;top:684.05pt;width:3.906pt;height:3.906pt;z-index:594;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:698.5pt;left:71.6539pt;z-index:610;">django.contrib.sessions<span class="fmt-12"> – A se</span><span class="fmt-12">ssi</span><span class="fmt-12">on framewo</span><span class="fmt-12">rk.</span></div></span><canvas id="_canv_108" style="position:absolute;left:61.691pt;top:702.12pt;width:3.906pt;height:3.906pt;z-index:611;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:716.57pt;left:71.6539pt;z-index:627;">django.contrib.messages<span class="fmt-12"> – A mess</span><span class="fmt-12">agi</span><span class="fmt-12">ng framew</span><span class="fmt-12">ork.</span></div></span><canvas id="_canv_109" style="position:absolute;left:61.691pt;top:720.19pt;width:3.906pt;height:3.906pt;z-index:628;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:734.64pt;left:71.6539pt;z-index:648;">django.contrib.staticfiles<span class="fmt-12"> – A framew</span><span class="fmt-12">ork fo</span><span class="fmt-12">r managi</span><span class="fmt-12">ng s</span><span class="fmt-12">tatic fil</span><span class="fmt-12">es</span><span class="fmt-12">.</span></div></span><canvas id="_canv_110" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_111" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_112" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_113" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_114" style="position:absolute;left:61.691pt;top:738.26pt;width:3.906pt;height:3.906pt;z-index:649;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:669;">4 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:669;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage4();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 5</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-12"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:489;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:489;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:36.928pt;left:52.1175pt;z-index:38;">These applications are included by default as a convenience for the common case.</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:60.3716pt;left:52.1175pt;z-index:54;">Some of these applications makes use of at least one database table, though, so we need to</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:74.0471pt;left:52.1175pt;z-index:70;letter-spacing:-.001em;">create the tables in the database before we can use them. To do that, run the following</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:87.7226pt;left:52.1175pt;z-index:71;">command:</div></span><canvas id="_canv_115" style="position:absolute;left:52.117pt;top:110.24pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-24" style="white-space:pre;"><div style="position:absolute;top:115.46pt;left:55.634pt;z-index:73;letter-spacing:-.001em;">$ <span class="fmt-25">python manage.py syncdb</span></div></span><canvas id="_canv_116" style="position:absolute;left:52.117pt;top:111.22pt;width:458.62pt;height:18.949pt;z-index:5;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:140.86pt;left:52.1175pt;z-index:94;"><span class="fmt-1">The </span>syncdb<span class="fmt-12"> co</span><span class="fmt-12">mmand l</span><span class="fmt-12">o</span><span class="fmt-12">oks at the </span>INSTALLED_APPS<span class="fmt-12"> setting and cre</span><span class="fmt-12">ate</span><span class="fmt-12">s any nece</span><span class="fmt-12">ssary</span></div></span><canvas id="_canv_117" style="position:absolute;left:52.117pt;top:130.16pt;width:458.62pt;height:1pt;z-index:7;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:155.03pt;left:52.1175pt;z-index:117;">database tables according to the database settings in your <span class="fmt-11">my</span><span class="fmt-11">si</span><span class="fmt-11">te</span><span class="fmt-11">/s</span><span class="fmt-11">ett</span><span class="fmt-11">in</span><span class="fmt-11">gs</span><span class="fmt-11">.p</span><span class="fmt-11">y</span> file. You’ll</div></span><span style="white-space:pre;"><div style="position:absolute;top:169.19pt;left:52.1175pt;z-index:127;">see a message for each database table it creates, and you’ll get a prompt asking you if you’d</div></span><span style="white-space:pre;"><div style="position:absolute;top:182.86pt;left:52.1175pt;z-index:136;">like to create a superuser account for the authentication system. Go ahead and do that.</div></span><span style="white-space:pre;"><div style="position:absolute;top:206.31pt;left:52.1175pt;z-index:147;">If you’re interested, run the command-line client for your database and type <span class="fmt-11">\dt</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:220.47pt;left:52.1175pt;z-index:171;">(PostgreSQL), <span class="fmt-11">SH</span><span class="fmt-11">OW</span> <span class="fmt-11">T</span><span class="fmt-11">AB</span><span class="fmt-11">LE</span><span class="fmt-11">S;</span> (MySQL), or <span class="fmt-11">.s</span><span class="fmt-11">ch</span><span class="fmt-11">em</span><span class="fmt-11">a</span> (SQLite) to display the tables Django</div></span><span style="white-space:pre;"><div style="position:absolute;top:234.64pt;left:52.1175pt;z-index:172;">created.</div></span><canvas id="_canv_118" style="position:absolute;left:52.117pt;top:257.15pt;width:457.64pt;height:1pt;z-index:9;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-21" style="white-space:pre;"><div style="position:absolute;top:266.87pt;left:100.71pt;z-index:175;">For the minimalists</div></span><span style="white-space:pre;"><div style="position:absolute;top:286.41pt;left:100.71pt;z-index:190;">Like we said above, the default applications are included for the common case,</div></span><span style="white-space:pre;"><div style="position:absolute;top:300.08pt;left:100.71pt;z-index:209;">but not everybody needs them. If you don’t need any or all of them, feel free to</div></span><span style="white-space:pre;"><div style="position:absolute;top:313.76pt;left:100.71pt;z-index:231;">comment-out or delete the appropriate line(s) from <span class="fmt-11">IN</span><span class="fmt-11">ST</span><span class="fmt-11">AL</span><span class="fmt-11">LE</span><span class="fmt-11">D_A</span><span class="fmt-11">PP</span><span class="fmt-11">S</span> before</div></span><span style="white-space:pre;"><div style="position:absolute;top:327.92pt;left:100.71pt;z-index:254;">running <span class="fmt-11">sy</span><span class="fmt-11">nc</span><span class="fmt-11">db</span>. The <span class="fmt-11">sy</span><span class="fmt-11">nc</span><span class="fmt-11">db</span> command will only create tables for apps in</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:342.84pt;left:100.71pt;z-index:263;">INSTALLED_APPS<span class="fmt-12">.</span></div></span><canvas id="_canv_119" style="position:absolute;left:53.094pt;top:258.13pt;width:456.66pt;height:105.01pt;z-index:8;" width="608.89" height="140.01">Your browser does not support the canvas tag!</canvas><canvas id="_canv_120" style="position:absolute;left:509.76pt;top:257.15pt;width:1pt;height:105.98pt;z-index:10;" width="1.3333" height="141.31">Your browser does not support the canvas tag!</canvas><span class="fmt-26" style="white-space:pre;"><div style="position:absolute;top:385.03pt;left:52.1175pt;z-index:264;">Creating models</div></span><canvas id="_canv_121" style="position:absolute;left:53.094pt;top:363.14pt;width:457.64pt;height:1pt;z-index:11;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_122" style="position:absolute;left:52.117pt;top:258.13pt;width:1pt;height:105.98pt;z-index:12;" width="1.3333" height="141.31">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:418.77pt;left:52.1175pt;z-index:281;">Now that your environment – a “project” – is set up, you’re set to start doing work.</div></span><canvas id="_canv_123" style="position:absolute;left:99.7382pt;top:354.34pt;width:84.3476pt;height:1.9536pt;z-index:255;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:442.21pt;left:52.1175pt;z-index:297;">Each application you write in Django consists of a Python package that follows a certain</div></span><canvas id="_canv_124" style="position:absolute;left:140.81pt;top:340.18pt;width:37.2666pt;height:1.9536pt;z-index:233;" width="49.6889" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:455.89pt;left:52.1175pt;z-index:315;letter-spacing:-.001em;">convention. Django comes with a utility that automatically generates the basic directory</div></span><canvas id="_canv_125" style="position:absolute;left:356.8pt;top:326.02pt;width:84.3486pt;height:1.9536pt;z-index:223;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_126" style="position:absolute;left:204.56pt;top:340.18pt;width:37.2666pt;height:1.9536pt;z-index:238;" width="49.6889" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:469.56pt;left:52.1175pt;z-index:327;letter-spacing:-.001em;">structure of an app, so you can focus on writing code rather than creating directories.</div></span><canvas id="_canv_127" style="position:absolute;left:52.117pt;top:492.08pt;width:457.64pt;height:1pt;z-index:14;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-21" style="white-space:pre;"><div style="position:absolute;top:501.8pt;left:100.71pt;z-index:328;">Projects vs. apps</div></span><span style="white-space:pre;"><div style="position:absolute;top:521.33pt;left:100.71pt;z-index:345;letter-spacing:-.001em;">What’s the difference between a project and an app? An app is a Web application</div></span><span style="white-space:pre;"><div style="position:absolute;top:535.01pt;left:100.71pt;z-index:359;letter-spacing:-.002em;">that does something – e.g., a Weblog system, a database of public records or a</div></span><span style="white-space:pre;"><div style="position:absolute;top:548.68pt;left:100.71pt;z-index:374;">simple poll app. A project is a collection of configuration and apps for a</div></span><span style="white-space:pre;"><div style="position:absolute;top:562.36pt;left:100.71pt;z-index:387;letter-spacing:-.001em;">particular Web site. A project can contain multiple apps. An app can be in</div></span><span style="white-space:pre;"><div style="position:absolute;top:576.03pt;left:100.71pt;z-index:388;">multiple projects.</div></span><canvas id="_canv_128" style="position:absolute;left:53.094pt;top:493.05pt;width:456.66pt;height:103.54pt;z-index:13;" width="608.89" height="138.06">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:608.27pt;left:52.1175pt;z-index:406;letter-spacing:-.001em;">Your apps can live anywhere on your <span class="fmt-23">Pytho</span><span class="fmt-23">n path</span>. In this tutorial, we’ll create our poll app</div></span><canvas id="_canv_129" style="position:absolute;left:509.76pt;top:492.08pt;width:1pt;height:104.52pt;z-index:15;" width="1.3333" height="139.36">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:621.94pt;left:52.1175pt;z-index:431;">right next to your <span class="fmt-11">ma</span><span class="fmt-11">na</span><span class="fmt-11">ge</span><span class="fmt-11">.p</span><span class="fmt-11">y</span> file so that it can be imported as its own top-level module,</div></span><canvas id="_canv_130" style="position:absolute;left:53.094pt;top:596.6pt;width:457.64pt;height:1pt;z-index:16;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_131" style="position:absolute;left:52.117pt;top:493.05pt;width:1pt;height:104.52pt;z-index:17;" width="1.3333" height="139.36">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:636.11pt;left:52.1175pt;z-index:438;">rather than a submodule of <span class="fmt-11">my</span><span class="fmt-11">si</span><span class="fmt-11">te</span>.</div></span><canvas id="_canv_132" style="position:absolute;left:72.5932pt;top:153.12pt;width:37.2666pt;height:1.9536pt;z-index:75;" width="49.6889" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:660.04pt;left:52.1175pt;z-index:454;letter-spacing:-.001em;">To create your app, make sure you’re in the same directory as <span class="fmt-11">ma</span><span class="fmt-11">na</span><span class="fmt-11">ge</span><span class="fmt-11">.p</span><span class="fmt-11">y</span> and type this</div></span><canvas id="_canv_133" style="position:absolute;left:224.18pt;top:153.12pt;width:84.3486pt;height:1.9536pt;z-index:83;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:674.2pt;left:52.1175pt;z-index:455;">command:</div></span><canvas id="_canv_134" style="position:absolute;left:52.117pt;top:696.72pt;width:458.62pt;height:1pt;z-index:19;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-27" style="white-space:pre;"><div style="position:absolute;top:701.94pt;left:55.634pt;z-index:457;letter-spacing:-.001em;">$ <span class="fmt-28">python manage.py startapp polls</span></div></span><canvas id="_canv_135" style="position:absolute;left:52.117pt;top:697.69pt;width:458.62pt;height:18.949pt;z-index:18;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:727.34pt;left:52.1175pt;z-index:474;">That’ll create a directory <span class="fmt-7">po</span><span class="fmt-7">ll</span><span class="fmt-7">s</span>, which is laid out like this:</div></span><canvas id="_canv_136" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_137" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_138" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_139" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_140" style="position:absolute;left:52.117pt;top:716.65pt;width:458.62pt;height:1pt;z-index:20;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:494;">5 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:494;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage5();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 6</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-1"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:465;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:465;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><canvas id="_canv_141" style="position:absolute;left:52.117pt;top:36pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-29" style="white-space:pre;"><div style="position:absolute;top:41.224pt;left:55.634pt;z-index:16;">polls/</div></span><span class="fmt-29" style="white-space:pre;"><div style="position:absolute;top:54.8995pt;left:55.634pt;z-index:17;letter-spacing:-.001em;">    __init__.py</div></span><span class="fmt-29" style="white-space:pre;"><div style="position:absolute;top:68.575pt;left:55.634pt;z-index:18;letter-spacing:-.001em;">    admin.py</div></span><span class="fmt-29" style="white-space:pre;"><div style="position:absolute;top:82.2504pt;left:55.634pt;z-index:19;letter-spacing:-.001em;">    models.py</div></span><canvas id="_canv_142" style="position:absolute;left:317.9pt;top:706.39pt;width:31.3796pt;height:1.9536pt;z-index:397;" width="41.8395" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-29" style="white-space:pre;"><div style="position:absolute;top:95.9259pt;left:55.634pt;z-index:20;letter-spacing:-.001em;">    tests.py</div></span><span class="fmt-29" style="white-space:pre;"><div style="position:absolute;top:109.6pt;left:55.634pt;z-index:21;letter-spacing:-.001em;">    views.py</div></span><canvas id="_canv_143" style="position:absolute;left:52.117pt;top:36.977pt;width:458.62pt;height:87.328pt;z-index:5;" width="611.49" height="116.44">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:135pt;left:52.1175pt;z-index:34;">This directory structure will house the poll application.</div></span><canvas id="_canv_144" style="position:absolute;left:52.117pt;top:124.3pt;width:458.62pt;height:1pt;z-index:7;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:158.44pt;left:52.1175pt;z-index:52;letter-spacing:-.002em;">The first step in writing a database Web app in Django is to define your models – essentially,</div></span><canvas id="_canv_145" style="position:absolute;left:101.92pt;top:617.5pt;width:78.4656pt;height:1.9536pt;z-index:322;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_146" style="position:absolute;left:142.57pt;top:655.11pt;width:31.3796pt;height:1.9536pt;z-index:344;" width="41.8395" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:172.12pt;left:52.1175pt;z-index:59;letter-spacing:-.001em;">your database layout, with additional metadata.</div></span><canvas id="_canv_147" style="position:absolute;left:52.117pt;top:194.64pt;width:457.64pt;height:1pt;z-index:9;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_148" style="position:absolute;left:272.57pt;top:603.34pt;width:31.3796pt;height:1.9536pt;z-index:304;" width="41.8395" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:204.35pt;left:100.71pt;z-index:61;">Philosophy</div></span><canvas id="_canv_149" style="position:absolute;left:51.1402pt;top:565.73pt;width:131.43pt;height:1.9536pt;z-index:263;" width="175.24" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_150" style="position:absolute;left:367.71pt;top:603.34pt;width:54.9226pt;height:1.9536pt;z-index:312;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:223.89pt;left:100.71pt;z-index:75;">A model is the single, definitive source of data about your data. It contains the</div></span><span style="white-space:pre;"><div style="position:absolute;top:237.57pt;left:100.71pt;z-index:93;">essential fields and behaviors of the data you’re storing. Django follows the <span class="fmt-2">DRY</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:251.24pt;left:100.71pt;z-index:109;"><span class="fmt-2">Pri</span><span class="fmt-2">nci</span><span class="fmt-2">ple</span><span>. The</span><span> go</span><span>al</span><span> i</span><span>s to de</span><span>fine your data model</span><span> in o</span><span>ne pl</span><span>ac</span><span>e and auto</span><span>mati</span><span>call</span><span>y</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:264.92pt;left:100.71pt;z-index:115;">derive things from it.</div></span><canvas id="_canv_151" style="position:absolute;left:53.094pt;top:195.61pt;width:456.66pt;height:89.867pt;z-index:8;" width="608.89" height="119.82">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:297.15pt;left:52.1175pt;z-index:139;">In our simple poll app, we’ll create two models: <span class="fmt-7">Po</span><span class="fmt-7">ll</span> and <span class="fmt-7">Ch</span><span class="fmt-7">oi</span><span class="fmt-7">ce</span>. A <span class="fmt-7">Po</span><span class="fmt-7">ll</span> has a question</div></span><canvas id="_canv_152" style="position:absolute;left:509.76pt;top:194.64pt;width:1pt;height:90.844pt;z-index:10;" width="1.3333" height="121.13">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:311.32pt;left:52.1175pt;z-index:155;letter-spacing:-.001em;">and a publication date. A <span class="fmt-7">Ch</span><span class="fmt-7">oi</span><span class="fmt-7">ce</span> has two fields: the text of the choice and a vote tally. Each</div></span><canvas id="_canv_153" style="position:absolute;left:53.094pt;top:285.48pt;width:457.64pt;height:1pt;z-index:11;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_154" style="position:absolute;left:52.117pt;top:195.61pt;width:1pt;height:90.844pt;z-index:12;" width="1.3333" height="121.13">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:326.23pt;left:52.1175pt;z-index:166;letter-spacing:.001em;"><span class="fmt-7">Ch</span><span class="fmt-7">oi</span><span class="fmt-7">ce</span> is associated with a <span class="fmt-7">Po</span><span class="fmt-7">ll</span>.</div></span><span style="white-space:pre;"><div style="position:absolute;top:349.41pt;left:52.1175pt;z-index:190;letter-spacing:-.002em;">These concepts are represented by simple Python classes. Edit the <span class="fmt-7">po</span><span class="fmt-7">ll</span><span class="fmt-7">s/</span><span class="fmt-7">mo</span><span class="fmt-7">del</span><span class="fmt-7">s.</span><span class="fmt-7">py</span> file so</div></span><span style="white-space:pre;"><div style="position:absolute;top:363.58pt;left:52.1175pt;z-index:196;">it looks like this:</div></span><canvas id="_canv_155" style="position:absolute;left:52.117pt;top:386.09pt;width:458.62pt;height:1pt;z-index:14;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-30" style="white-space:pre;"><div style="position:absolute;top:391.32pt;left:55.634pt;z-index:200;letter-spacing:-.001em;">from django.db import models</div></span><span class="fmt-31" style="white-space:pre;"><div style="position:absolute;top:418.67pt;left:55.634pt;z-index:205;letter-spacing:-.001em;">class <span class="fmt-32">Poll</span><span class="fmt-30">(models</span>.<span class="fmt-30">Model):</span></div></span><span class="fmt-30" style="white-space:pre;"><div style="position:absolute;top:432.34pt;left:55.634pt;z-index:213;letter-spacing:-.001em;">    question<span class="fmt-31">=</span> models <span class="fmt-31">.</span>CharField(max_length<span class="fmt-31">=</span><span class="fmt-33">200</span>)</div></span><span class="fmt-30" style="white-space:pre;"><div style="position:absolute;top:446.02pt;left:55.6341pt;z-index:220;letter-spacing:-.001em;">    pub_date<span class="fmt-31">=</span> models <span class="fmt-31">.</span>DateTimeField(<span class="fmt-34">'date published'</span>)</div></span><span class="fmt-31" style="white-space:pre;"><div style="position:absolute;top:473.37pt;left:55.6341pt;z-index:225;letter-spacing:-.001em;">class <span class="fmt-32">Choice</span><span class="fmt-30">(models</span>.<span class="fmt-30">Model):</span></div></span><span class="fmt-30" style="white-space:pre;"><div style="position:absolute;top:487.04pt;left:55.634pt;z-index:230;letter-spacing:-.001em;">    poll<span class="fmt-31">=</span> models <span class="fmt-31">.</span>ForeignKey(Poll)</div></span><span class="fmt-30" style="white-space:pre;"><div style="position:absolute;top:500.72pt;left:55.634pt;z-index:238;letter-spacing:-.001em;">    choice_text<span class="fmt-31">=</span> models <span class="fmt-31">.</span>CharField(max_length<span class="fmt-31">=</span><span class="fmt-33">200</span>)</div></span><span class="fmt-30" style="white-space:pre;"><div style="position:absolute;top:514.39pt;left:55.6341pt;z-index:246;letter-spacing:-.001em;">    votes<span class="fmt-31">=</span> models <span class="fmt-31">.</span>IntegerField(default<span class="fmt-31">=</span><span class="fmt-33">0</span>)</div></span><canvas id="_canv_156" style="position:absolute;left:52.117pt;top:387.07pt;width:458.62pt;height:142.03pt;z-index:13;" width="611.49" height="189.37">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:539.79pt;left:52.1175pt;z-index:262;">The code is straightforward. Each model is represented by a class that subclasses</div></span><canvas id="_canv_157" style="position:absolute;left:52.117pt;top:529.1pt;width:458.62pt;height:1pt;z-index:15;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:554.22pt;left:52.1175pt;z-index:286;"><span class="fmt-11">dj</span><span class="fmt-11">an</span><span class="fmt-11">go</span><span class="fmt-11">.d</span><span class="fmt-11">b.m</span><span class="fmt-11">od</span><span class="fmt-11">el</span><span class="fmt-11">s.</span><span class="fmt-11">Mo</span><span class="fmt-11">del</span>. Each model has a number of class variables, each of which</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:567.63pt;left:52.1175pt;z-index:294;">represents a database field in the model.</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:591.08pt;left:52.1175pt;z-index:319;">Each field is represented by an instance of a <span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span> class – e.g., <span class="fmt-11">Ch</span><span class="fmt-11">ar</span><span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span> for character</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:605.24pt;left:52.1175pt;z-index:339;">fields and <span class="fmt-11">Da</span><span class="fmt-11">te</span><span class="fmt-11">Ti</span><span class="fmt-11">me</span><span class="fmt-11">Fie</span><span class="fmt-11">ld</span> for datetimes. This tells Django what type of data each field</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:619.4pt;left:52.1175pt;z-index:340;">holds.</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:642.85pt;left:52.1175pt;z-index:363;">The name of each <span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span> instance (e.g. <span class="fmt-11">qu</span><span class="fmt-11">es</span><span class="fmt-11">ti</span><span class="fmt-11">on</span> or <span class="fmt-11">pu</span><span class="fmt-11">b_</span><span class="fmt-11">da</span><span class="fmt-11">te</span>) is the field’s name, in</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:657.01pt;left:52.1175pt;z-index:383;letter-spacing:-.001em;">machine-friendly format. You’ll use this value in your Python code, and your database will</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:670.69pt;left:52.1175pt;z-index:388;">use it as the column name.</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:694.13pt;left:52.1175pt;z-index:403;">You can use an optional first positional argument to a <span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span> to designate a human-readable</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:708.3pt;left:52.1175pt;z-index:416;letter-spacing:-.001em;">name. That’s used in a couple of introspective parts of Django, and it doubles as</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:721.97pt;left:52.1175pt;z-index:431;">documentation. If this field isn’t provided, Django will use the machine-readable name. In</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:735.65pt;left:52.1175pt;z-index:450;">this example, we’ve only defined a human-readable name for <span class="fmt-11">Po</span><span class="fmt-11">ll</span><span class="fmt-11">.p</span><span class="fmt-11">ub</span><span class="fmt-11">_da</span><span class="fmt-11">te</span>. For all other</div></span><canvas id="_canv_158" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_159" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_160" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_161" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:470;">6 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:470;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage6();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 7</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-12"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:400;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:400;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:36.928pt;left:52.1175pt;z-index:36;">fields in this model, the field’s machine-readable name will suffice as its human-readable</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:50.6034pt;left:52.1175pt;z-index:37;">name.</div></span><span style="white-space:pre;"><div style="position:absolute;top:74.0471pt;left:52.1175pt;z-index:63;"><span class="fmt-1">So</span><span class="fmt-1">me </span><span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span><span> cl</span><span>asse</span><span>s have</span><span> re</span><span>quired argume</span><span>nts</span><span>. </span><span class="fmt-11">Ch</span><span class="fmt-11">ar</span><span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span><span>, fo</span><span>r e</span><span>xample</span><span>, re</span><span>quires</span><span> that yo</span><span>u</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:88.2109pt;left:52.1175pt;z-index:86;letter-spacing:-.001em;">give it a <span class="fmt-11">ma</span><span class="fmt-11">x_</span><span class="fmt-11">le</span><span class="fmt-11">ng</span><span class="fmt-11">th</span>. That’s used not only in the database schema, but in validation, as we’ll</div></span><span style="white-space:pre;"><div style="position:absolute;top:102.37pt;left:52.1175pt;z-index:89;">soon see.</div></span><span style="white-space:pre;"><div style="position:absolute;top:125.82pt;left:52.1175pt;z-index:115;">A <span class="fmt-11">Fi</span><span class="fmt-11">el</span><span class="fmt-11">d</span><span> can al</span><span>so</span><span> have va</span><span>rio</span><span>us</span><span> o</span><span>pti</span><span>onal</span><span> arguments; i</span><span>n thi</span><span>s case, w</span><span>e’ve se</span><span>t the </span><span class="fmt-11">de</span><span class="fmt-11">fa</span><span class="fmt-11">ul</span><span class="fmt-11">t</span><span> va</span><span>l</span><span>ue</span></div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:139.98pt;left:52.1175pt;z-index:120;"><span class="fmt-12">of </span>votes<span class="fmt-12"> to 0.</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:163.91pt;left:52.1175pt;z-index:145;letter-spacing:-.001em;">Finally, note a relationship is defined, using <span class="fmt-11">Fo</span><span class="fmt-11">re</span><span class="fmt-11">ig</span><span class="fmt-11">nK</span><span class="fmt-11">ey</span>. That tells Django each <span class="fmt-11">Ch</span><span class="fmt-11">oi</span><span class="fmt-11">ce</span> is</div></span><span style="white-space:pre;"><div style="position:absolute;top:178.08pt;left:52.1175pt;z-index:168;letter-spacing:-.003em;">related to a single <span class="fmt-11">Po</span><span class="fmt-11">ll</span><span>. Django</span><span> s</span><span>uppo</span><span>rts al</span><span>l</span><span> the co</span><span>mmo</span><span>n database</span><span> re</span><span>lati</span><span>o</span><span>ns</span><span>hi</span><span>ps</span><span>:</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:192.24pt;left:52.1175pt;z-index:178;letter-spacing:-.002em;">many-to-ones, many-to-manys and one-to-ones.</div></span><span class="fmt-26" style="white-space:pre;"><div style="position:absolute;top:225.91pt;left:52.1175pt;z-index:179;">Activating models</div></span><span style="white-space:pre;"><div style="position:absolute;top:259.64pt;left:52.1175pt;z-index:200;">That small bit of model code gives Django a lot of information. With it, Django is able to:</div></span><span style="white-space:pre;"><div style="position:absolute;top:283.09pt;left:71.6539pt;z-index:214;">Create a database schema (<span class="fmt-11">CR</span><span class="fmt-11">EA</span><span class="fmt-11">TE</span> <span class="fmt-11">T</span><span class="fmt-11">AB</span><span class="fmt-11">LE</span> statements) for this app.</div></span><canvas id="_canv_162" style="position:absolute;left:61.691pt;top:287.46pt;width:3.906pt;height:3.906pt;z-index:215;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:301.16pt;left:71.6539pt;z-index:232;">Create a Python database-access API for accessing <span class="fmt-11">Po</span><span class="fmt-11">ll</span> and <span class="fmt-11">Ch</span><span class="fmt-11">oi</span><span class="fmt-11">ce</span> objects.</div></span><canvas id="_canv_163" style="position:absolute;left:61.691pt;top:305.53pt;width:3.906pt;height:3.906pt;z-index:233;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:323.14pt;left:52.1175pt;z-index:252;">But first we need to tell our project that the <span class="fmt-11">po</span><span class="fmt-11">ll</span><span class="fmt-11">s</span> app is installed.</div></span><canvas id="_canv_164" style="position:absolute;left:52.117pt;top:346.14pt;width:457.64pt;height:1pt;z-index:6;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_165" style="position:absolute;left:333.2pt;top:447.24pt;width:84.3516pt;height:1.9536pt;z-index:294;" width="112.47" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-21" style="white-space:pre;"><div style="position:absolute;top:355.86pt;left:100.71pt;z-index:254;">Philosophy</div></span><span style="white-space:pre;"><div style="position:absolute;top:375.4pt;left:100.71pt;z-index:265;letter-spacing:-.001em;">Django apps are “pluggable”: You can use an app in multiple projects, and you</div></span><span style="white-space:pre;"><div style="position:absolute;top:389.07pt;left:100.71pt;z-index:274;">can distribute apps, because they don’t have to be tied to a given Django</div></span><span style="white-space:pre;"><div style="position:absolute;top:402.75pt;left:100.71pt;z-index:279;">installation.</div></span><canvas id="_canv_166" style="position:absolute;left:53.094pt;top:347.12pt;width:456.66pt;height:76.191pt;z-index:5;" width="608.89" height="101.59">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:434.98pt;left:52.1175pt;z-index:302;letter-spacing:-.003em;"><span class="fmt-12">Edit the </span><span>my</span><span>si</span><span>te</span><span>/s</span><span>ett</span><span>in</span><span>gs</span><span>.p</span><span>y</span><span class="fmt-12"> fi</span><span class="fmt-12">l</span><span class="fmt-12">e agai</span><span class="fmt-12">n, and change the</span> <span>IN</span><span>ST</span><span>AL</span><span>LE</span><span>D_A</span><span>PP</span><span>S</span><span class="fmt-12"> setting to include</span></div></span><canvas id="_canv_167" style="position:absolute;left:509.76pt;top:346.14pt;width:1pt;height:77.168pt;z-index:7;" width="1.3333" height="102.89">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:449.15pt;left:52.1175pt;z-index:319;">the string <span class="fmt-11">'p</span><span class="fmt-11">ol</span><span class="fmt-11">ls</span><span class="fmt-11">'</span>. So it’ll look like this:</div></span><canvas id="_canv_168" style="position:absolute;left:53.094pt;top:423.31pt;width:457.64pt;height:1pt;z-index:8;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_169" style="position:absolute;left:52.117pt;top:347.12pt;width:1pt;height:77.168pt;z-index:9;" width="1.3333" height="102.89">Your browser does not support the canvas tag!</canvas><span class="fmt-35" style="white-space:pre;"><div style="position:absolute;top:477.37pt;left:55.634pt;z-index:322;letter-spacing:-.001em;">INSTALLED_APPS<span class="fmt-36">=</span> (</div></span><canvas id="_canv_170" style="position:absolute;left:52.117pt;top:472.15pt;width:458.62pt;height:1pt;z-index:11;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:491.05pt;left:76.7822pt;z-index:324;letter-spacing:-.001em;">'django.contrib.admin'<span class="fmt-35">,</span></div></span><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:504.72pt;left:76.7822pt;z-index:326;letter-spacing:-.001em;">'django.contrib.auth'<span class="fmt-35">,</span></div></span><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:518.4pt;left:76.7822pt;z-index:328;letter-spacing:-.001em;">'django.contrib.contenttypes'<span class="fmt-35">,</span></div></span><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:532.08pt;left:76.7822pt;z-index:330;letter-spacing:-.001em;">'django.contrib.sessions'<span class="fmt-35">,</span></div></span><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:545.75pt;left:76.7822pt;z-index:332;letter-spacing:-.001em;">'django.contrib.messages'<span class="fmt-35">,</span></div></span><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:559.43pt;left:76.7822pt;z-index:334;letter-spacing:-.001em;">'django.contrib.staticfiles'<span class="fmt-35">,</span></div></span><span class="fmt-37" style="white-space:pre;"><div style="position:absolute;top:573.1pt;left:76.7822pt;z-index:336;letter-spacing:-.001em;">'polls'<span class="fmt-35">,</span></div></span><span class="fmt-35" style="white-space:pre;"><div style="position:absolute;top:586.78pt;left:55.634pt;z-index:337;">)</div></span><canvas id="_canv_171" style="position:absolute;left:52.117pt;top:473.13pt;width:458.62pt;height:128.35pt;z-index:10;" width="611.49" height="171.14">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:612.18pt;left:52.1175pt;z-index:348;">Now Django knows to include the <span class="fmt-7">po</span><span class="fmt-7">ll</span><span class="fmt-7">s</span> app. Let’s run another command:</div></span><canvas id="_canv_172" style="position:absolute;left:52.117pt;top:601.48pt;width:458.62pt;height:1pt;z-index:12;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-38" style="white-space:pre;"><div style="position:absolute;top:640.4pt;left:55.634pt;z-index:350;letter-spacing:-.001em;">$ <span class="fmt-39">python manage.py sql polls</span></div></span><canvas id="_canv_173" style="position:absolute;left:52.117pt;top:636.16pt;width:458.62pt;height:18.949pt;z-index:13;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><canvas id="_canv_174" style="position:absolute;left:52.117pt;top:635.18pt;width:458.62pt;height:1pt;z-index:14;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_175" style="position:absolute;left:267.81pt;top:176.17pt;width:60.8056pt;height:1.9536pt;z-index:130;" width="81.0742" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:665.8pt;left:52.1175pt;z-index:368;">You should see something similar to the following (the <span class="fmt-7">CR</span><span class="fmt-7">EA</span><span class="fmt-7">TE</span> <span class="fmt-7">T</span><span class="fmt-7">AB</span><span class="fmt-7">LE</span> SQL statements for</div></span><canvas id="_canv_176" style="position:absolute;left:52.117pt;top:655.1pt;width:458.62pt;height:1pt;z-index:15;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_177" style="position:absolute;left:61.2502pt;top:138.08pt;width:31.3786pt;height:1.9536pt;z-index:91;" width="41.8382" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:679.97pt;left:52.1175pt;z-index:372;">the polls app):</div></span><canvas id="_canv_178" style="position:absolute;left:52.117pt;top:702.48pt;width:458.62pt;height:1pt;z-index:17;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_179" style="position:absolute;left:94.1092pt;top:100.47pt;width:60.8056pt;height:1.9536pt;z-index:67;" width="81.0742" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_180" style="position:absolute;left:438.01pt;top:138.08pt;width:43.1496pt;height:1.9536pt;z-index:108;" width="57.5328" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-40" style="white-space:pre;"><div style="position:absolute;top:707.71pt;left:55.634pt;z-index:374;">BEGIN<span class="fmt-41">;</span></div></span><canvas id="_canv_181" style="position:absolute;left:82.5072pt;top:86.3042pt;width:31.3836pt;height:1.9536pt;z-index:40;" width="41.8448" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-40" style="white-space:pre;"><div style="position:absolute;top:721.38pt;left:55.634pt;z-index:378;letter-spacing:-.001em;">CREATE TABLE <span class="fmt-42">"polls_poll"</span> <span class="fmt-41">(</span></div></span><canvas id="_canv_182" style="position:absolute;left:284.59pt;top:86.3042pt;width:54.9186pt;height:1.9536pt;z-index:51;" width="73.2248" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-40" style="white-space:pre;"><div style="position:absolute;top:735.06pt;left:76.7822pt;z-index:385;letter-spacing:-.001em;"><span class="fmt-42">"id"</span> <span class="fmt-41">integer</span>NOT  NULL PRIMARY KEY<span class="fmt-41">,</span></div></span><canvas id="_canv_183" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_184" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_185" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_186" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_187" style="position:absolute;left:52.117pt;top:703.46pt;width:458.62pt;height:52.457pt;z-index:16;" width="611.49" height="69.9427">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:405;">7 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:405;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage7();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 8</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-12"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:532;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:532;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><canvas id="_canv_188" style="position:absolute;left:72.5932pt;top:752.11pt;width:37.2666pt;height:1.9536pt;z-index:503;" width="49.6889" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-44" style="white-space:pre;"><div style="position:absolute;top:37.6098pt;left:76.7822pt;z-index:16;letter-spacing:-.001em;"><span class="fmt-43">"question"</span> varchar(<span class="fmt-45">200</span>)<span class="fmt-46">NOT</span>  <span class="fmt-46">NULL</span>,</div></span><canvas id="_canv_189" style="position:absolute;left:256.93pt;top:752.11pt;width:37.2626pt;height:1.9536pt;z-index:510;" width="49.6835" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-46" style="white-space:pre;"><div style="position:absolute;top:51.2853pt;left:76.7822pt;z-index:20;letter-spacing:-.001em;"><span class="fmt-43">"pub_date"</span> <span class="fmt-44">datetime</span>NOT  NULL</div></span><span class="fmt-44" style="white-space:pre;"><div style="position:absolute;top:64.9608pt;left:55.634pt;z-index:21;">);</div></span><span class="fmt-46" style="white-space:pre;"><div style="position:absolute;top:78.6362pt;left:55.634pt;z-index:25;letter-spacing:-.001em;">CREATE TABLE <span class="fmt-43">"polls_choice"</span> <span class="fmt-44">(</span></div></span><canvas id="_canv_190" style="position:absolute;left:98.9682pt;top:698.48pt;width:37.2666pt;height:1.9536pt;z-index:486;" width="49.6888" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-46" style="white-space:pre;"><div style="position:absolute;top:92.3116pt;left:76.7822pt;z-index:32;letter-spacing:-.001em;"><span class="fmt-43">"id"</span> <span class="fmt-44">integer</span>NOT  NULL PRIMARY KEY<span class="fmt-44">,</span></div></span><span class="fmt-43" style="white-space:pre;"><div style="position:absolute;top:105.99pt;left:76.7822pt;z-index:41;letter-spacing:-.001em;">"poll_id" <span class="fmt-44">integer</span><span class="fmt-46">NOT</span>  <span class="fmt-46">NULL</span> <span class="fmt-46">REFERENCES</span> "polls_poll" <span class="fmt-44">(</span>"id"<span class="fmt-44">),</span></div></span><span class="fmt-44" style="white-space:pre;"><div style="position:absolute;top:119.66pt;left:76.7822pt;z-index:48;letter-spacing:-.001em;"><span class="fmt-43">"choice_text"</span> varchar(<span class="fmt-45">200</span>)<span class="fmt-46">NOT</span>  <span class="fmt-46">NULL</span>,</div></span><span class="fmt-46" style="white-space:pre;"><div style="position:absolute;top:133.34pt;left:76.7822pt;z-index:52;letter-spacing:-.001em;"><span class="fmt-43">"votes"</span> <span class="fmt-44">integer</span>NOT  NULL</div></span><span class="fmt-44" style="white-space:pre;"><div style="position:absolute;top:147.01pt;left:55.634pt;z-index:53;">);</div></span><canvas id="_canv_191" style="position:absolute;left:70.6752pt;top:639.38pt;width:54.9226pt;height:1.9536pt;z-index:450;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-46" style="white-space:pre;"><div style="position:absolute;top:160.69pt;left:55.634pt;z-index:55;">COMMIT<span class="fmt-44">;</span></div></span><canvas id="_canv_192" style="position:absolute;left:52.117pt;top:36pt;width:458.62pt;height:139.39pt;z-index:5;" width="611.49" height="185.85">Your browser does not support the canvas tag!</canvas><canvas id="_canv_193" style="position:absolute;left:70.6752pt;top:625.22pt;width:172.63pt;height:1.9536pt;z-index:427;" width="230.17" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_194" style="position:absolute;left:152.18pt;top:639.38pt;width:60.8096pt;height:1.9536pt;z-index:457;" width="81.0795" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:186.09pt;left:52.1175pt;z-index:62;">Note the following:</div></span><canvas id="_canv_195" style="position:absolute;left:52.117pt;top:175.39pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_196" style="position:absolute;left:443.66pt;top:625.22pt;width:19.6096pt;height:1.9536pt;z-index:447;" width="26.1462" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:209.53pt;left:71.6539pt;z-index:75;letter-spacing:-.001em;">The exact output will vary depending on the database you are using. The example above</div></span><canvas id="_canv_197" style="position:absolute;left:61.691pt;top:213.9pt;width:3.906pt;height:3.906pt;z-index:84;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><canvas id="_canv_198" style="position:absolute;left:70.6752pt;top:593.47pt;width:196.17pt;height:1.9536pt;z-index:399;" width="261.56" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:223.21pt;left:71.6539pt;z-index:83;letter-spacing:-.001em;">is generated for SQLite.</div></span><canvas id="_canv_199" style="position:absolute;left:70.6752pt;top:561.72pt;width:184.4pt;height:1.9536pt;z-index:360;" width="245.87" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:240.79pt;left:71.6539pt;z-index:101;letter-spacing:-.001em;">Table names are automatically generated by combining the name of the app (<span class="fmt-7">po</span><span class="fmt-7">ll</span><span class="fmt-7">s</span>) and</div></span><canvas id="_canv_200" style="position:absolute;left:61.691pt;top:245.16pt;width:3.906pt;height:3.906pt;z-index:122;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:254.95pt;left:71.6539pt;z-index:121;letter-spacing:-.002em;">the lowercase name of the model – <span class="fmt-7">po</span><span class="fmt-7">ll</span> and <span class="fmt-7">ch</span><span class="fmt-7">oi</span><span class="fmt-7">ce</span>. (You can override this behavior.)</div></span><canvas id="_canv_201" style="position:absolute;left:70.6752pt;top:529.98pt;width:190.29pt;height:1.9536pt;z-index:320;" width="253.71" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:273.02pt;left:71.6539pt;z-index:131;letter-spacing:-.003em;">Primary keys (IDs) are added automatically. (You can override this, too.)</div></span><canvas id="_canv_202" style="position:absolute;left:61.691pt;top:277.4pt;width:3.906pt;height:3.906pt;z-index:132;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:290.61pt;left:71.6539pt;z-index:146;letter-spacing:-.001em;">By convention, Django appends <span class="fmt-7">"_</span><span class="fmt-7">id</span><span class="fmt-7">"</span> to the foreign key field name. (Yes, you can</div></span><canvas id="_canv_203" style="position:absolute;left:61.691pt;top:294.98pt;width:3.906pt;height:3.906pt;z-index:153;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><canvas id="_canv_204" style="position:absolute;left:70.6752pt;top:498.23pt;width:149.09pt;height:1.9536pt;z-index:293;" width="198.78" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:304.77pt;left:71.6539pt;z-index:152;letter-spacing:-.001em;">override this, as well.)</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:322.35pt;left:71.6539pt;z-index:168;">The foreign key relationship is made explicit by a <span class="fmt-7">RE</span><span class="fmt-7">FE</span><span class="fmt-7">RE</span><span class="fmt-7">NC</span><span class="fmt-7">ES</span> statement.</div></span><canvas id="_canv_205" style="position:absolute;left:61.691pt;top:326.73pt;width:3.906pt;height:3.906pt;z-index:169;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:340.43pt;left:71.6539pt;z-index:182;letter-spacing:-.001em;">It’s tailored to the database you’re using, so database-specific field types such as</div></span><canvas id="_canv_206" style="position:absolute;left:61.691pt;top:344.8pt;width:3.906pt;height:3.906pt;z-index:227;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:354.85pt;left:71.6539pt;z-index:208;">auto_increment<span class="fmt-1"> (MySQL), </span>serial<span class="fmt-1"> (Po</span><span class="fmt-1">stgreSQ</span><span class="fmt-1">L), or </span>integer primary key<span class="fmt-1"> (SQ</span><span class="fmt-1">Li</span><span class="fmt-1">te) are</span></div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:368.26pt;left:71.6539pt;z-index:225;letter-spacing:-.002em;">handled for you automatically. Same goes for quoting of field names – e.g., using double</div></span><canvas id="_canv_207" style="position:absolute;left:92.1282pt;top:411.78pt;width:19.6106pt;height:1.9536pt;z-index:229;" width="26.1475" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:381.94pt;left:71.6539pt;z-index:226;">quotes or single quotes.</div></span><span style="white-space:pre;"><div style="position:absolute;top:399.52pt;left:71.6539pt;z-index:241;"><span class="fmt-1">The </span><span class="fmt-11">sql</span> command doesn’t actually run the SQL in your database - it just prints it to the</div></span><canvas id="_canv_208" style="position:absolute;left:61.691pt;top:403.89pt;width:3.906pt;height:3.906pt;z-index:280;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:413.69pt;left:71.6539pt;z-index:251;letter-spacing:-.001em;">screen so that you can see what SQL Django thinks is required. If you wanted to, you</div></span><span style="white-space:pre;"><div style="position:absolute;top:427.36pt;left:71.6539pt;z-index:268;letter-spacing:-.002em;">could copy and paste this SQL into your database prompt. However, as we will see</div></span><span style="white-space:pre;"><div style="position:absolute;top:441.04pt;left:71.6539pt;z-index:279;letter-spacing:-.002em;">shortly, Django provides an easier way of committing the SQL to the database.</div></span><span style="white-space:pre;"><div style="position:absolute;top:462.53pt;left:52.1175pt;z-index:292;">If you’re interested, also run the following commands:</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:486.72pt;left:71.6539pt;z-index:316;">python manage.py validate<span class="fmt-12"> – Che</span><span class="fmt-12">cks</span><span class="fmt-12"> fo</span><span class="fmt-12">r any</span><span class="fmt-12"> e</span><span class="fmt-12">rrors in the</span><span class="fmt-12"> c</span><span class="fmt-12">onstructi</span><span class="fmt-12">on o</span><span class="fmt-12">f yo</span><span class="fmt-12">ur</span></div></span><canvas id="_canv_209" style="position:absolute;left:61.691pt;top:490.34pt;width:3.906pt;height:3.906pt;z-index:319;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:500.14pt;left:71.6539pt;z-index:318;">models.</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:518.47pt;left:71.6539pt;z-index:342;">python manage.py sqlcustom polls<span class="fmt-12"> – Outputs any </span><span class="fmt-23">custom SQ</span><span class="fmt-23">L stateme</span><span class="fmt-23">nts</span><span class="fmt-12"> (s</span><span class="fmt-12">uc</span><span class="fmt-12">h as</span></div></span><canvas id="_canv_210" style="position:absolute;left:61.691pt;top:522.09pt;width:3.906pt;height:3.906pt;z-index:359;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:531.88pt;left:71.6539pt;z-index:358;">table modifications or constraints) that are defined for the application.</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:550.22pt;left:71.6539pt;z-index:385;">python manage.py sqlclear polls<span class="fmt-12"> – Outputs the nec</span><span class="fmt-12">ess</span><span class="fmt-12">ary </span>DROP TABLE<span class="fmt-12"> stateme</span><span class="fmt-12">nts</span></div></span><canvas id="_canv_211" style="position:absolute;left:61.691pt;top:553.84pt;width:3.906pt;height:3.906pt;z-index:398;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:563.63pt;left:71.6539pt;z-index:397;letter-spacing:-.001em;">for this app, according to which tables already exist in your database (if any).</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:581.96pt;left:71.6539pt;z-index:424;">python manage.py sqlindexes polls<span class="fmt-12"> – Outputs the </span>CREATE INDEX<span class="fmt-12"> stateme</span><span class="fmt-12">nts for this</span></div></span><canvas id="_canv_212" style="position:absolute;left:61.691pt;top:585.58pt;width:3.906pt;height:3.906pt;z-index:426;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:595.37pt;left:71.6539pt;z-index:425;letter-spacing:-.002em;">app.</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:613.71pt;left:71.6539pt;z-index:449;letter-spacing:-.003em;">python manage.py sqlall polls<span class="fmt-12"> – A co</span><span class="fmt-12">mbinati</span><span class="fmt-12">on of al</span><span class="fmt-12">l the</span><span class="fmt-12"> SQL from the</span> sql<span class="fmt-12">,</span></div></span><canvas id="_canv_213" style="position:absolute;left:61.691pt;top:617.33pt;width:3.906pt;height:3.906pt;z-index:465;" width="5.208" height="5.208">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:627.87pt;left:71.6539pt;z-index:464;">sqlcustom<span class="fmt-12">, and </span>sqlindexes<span class="fmt-12"> co</span><span class="fmt-12">mmands.</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:649.1pt;left:52.1175pt;z-index:478;letter-spacing:-.001em;">Looking at the output of those commands can help you understand what’s actually</div></span><span style="white-space:pre;"><div style="position:absolute;top:662.78pt;left:52.1175pt;z-index:483;">happening under the hood.</div></span><span style="white-space:pre;"><div style="position:absolute;top:686.22pt;left:52.1175pt;z-index:499;letter-spacing:-.001em;">Now, run <span class="fmt-11">sy</span><span class="fmt-11">nc</span><span class="fmt-11">db</span> again to create those model tables in your database:</div></span><canvas id="_canv_214" style="position:absolute;left:52.117pt;top:709.22pt;width:458.62pt;height:1pt;z-index:8;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-47" style="white-space:pre;"><div style="position:absolute;top:714.45pt;left:55.634pt;z-index:501;letter-spacing:-.001em;">$ <span class="fmt-48">python manage.py syncdb</span></div></span><canvas id="_canv_215" style="position:absolute;left:52.117pt;top:710.2pt;width:458.62pt;height:18.949pt;z-index:7;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:739.85pt;left:52.1175pt;z-index:517;"><span class="fmt-1">The </span><span class="fmt-11">sy</span><span class="fmt-11">nc</span><span class="fmt-11">db</span> command runs the SQL from <span class="fmt-11">sq</span><span class="fmt-11">la</span><span class="fmt-11">ll</span> on your database for all apps in</div></span><canvas id="_canv_216" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_217" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_218" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_219" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_220" style="position:absolute;left:52.117pt;top:729.15pt;width:458.62pt;height:1pt;z-index:9;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:537;">8 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:537;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage8();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 9</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-12"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:333;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:333;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span style="white-space:pre;"><div style="position:absolute;top:37.6801pt;left:52.1175pt;z-index:34;"><span class="fmt-11">IN</span><span class="fmt-11">ST</span><span class="fmt-11">AL</span><span class="fmt-11">LE</span><span class="fmt-11">D_A</span><span class="fmt-11">PP</span><span class="fmt-11">S</span> that don’t already exist in your database. This creates all the tables, initial</div></span><span style="white-space:pre;"><div style="position:absolute;top:51.0919pt;left:52.1175pt;z-index:45;letter-spacing:-.001em;">data and indexes for any apps you’ve added to your project since the last time you ran</div></span><span style="white-space:pre;"><div style="position:absolute;top:64.7673pt;left:52.1175pt;z-index:72;">syncdb. <span class="fmt-11">sy</span><span class="fmt-11">nc</span><span class="fmt-11">db</span><span> can be</span><span> c</span><span>al</span><span>le</span><span>d as</span><span> o</span><span>fte</span><span>n as yo</span><span>u l</span><span>ike</span><span>, and it w</span><span>il</span><span>l</span><span> o</span><span>nly e</span><span>ver c</span><span>re</span><span>ate the</span><span> tabl</span><span>es</span><span> that</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:78.9311pt;left:52.1175pt;z-index:77;letter-spacing:.002em;">don’t exist.</div></span><span style="white-space:pre;"><div style="position:absolute;top:102.37pt;left:52.1175pt;z-index:96;letter-spacing:-.003em;">Read the <span class="fmt-23">django-admin.py do</span><span class="fmt-23">cumentatio</span><span class="fmt-23">n</span> for full information on what the <span class="fmt-11">ma</span><span class="fmt-11">na</span><span class="fmt-11">ge</span><span class="fmt-11">.p</span><span class="fmt-11">y</span> utility</div></span><span style="white-space:pre;"><div style="position:absolute;top:116.54pt;left:52.1175pt;z-index:97;letter-spacing:-.001em;">can do.</div></span><span class="fmt-26" style="white-space:pre;"><div style="position:absolute;top:150.2pt;left:52.1175pt;z-index:99;">Playing with the API</div></span><span style="white-space:pre;"><div style="position:absolute;top:183.94pt;left:52.1175pt;z-index:118;letter-spacing:-.001em;">Now, let’s hop into the interactive Python shell and play around with the free API Django</div></span><span style="white-space:pre;"><div style="position:absolute;top:197.61pt;left:52.1175pt;z-index:128;letter-spacing:-.003em;">gives you. To invoke the Python shell, use this command:</div></span><canvas id="_canv_221" style="position:absolute;left:52.117pt;top:220.13pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-49" style="white-space:pre;"><div style="position:absolute;top:225.35pt;left:55.634pt;z-index:130;letter-spacing:-.001em;">$ <span class="fmt-50">python manage.py shell</span></div></span><canvas id="_canv_222" style="position:absolute;left:52.117pt;top:221.1pt;width:458.62pt;height:18.949pt;z-index:5;" width="611.49" height="25.2653">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:250.75pt;left:52.1175pt;z-index:148;letter-spacing:-.005em;">We’re using this instead of simply typing “python”, because <span class="fmt-7">ma</span><span class="fmt-7">na</span><span class="fmt-7">ge</span><span class="fmt-7">.p</span><span class="fmt-7">y</span> sets the</div></span><canvas id="_canv_223" style="position:absolute;left:52.117pt;top:240.06pt;width:458.62pt;height:1pt;z-index:7;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:265.67pt;left:52.1175pt;z-index:165;">DJANGO_SETTINGS_MODULE<span class="fmt-1"> env</span><span class="fmt-1">ironment va</span><span class="fmt-1">ri</span><span class="fmt-1">able</span><span class="fmt-1">, which gi</span><span class="fmt-1">ves Django the</span><span class="fmt-1"> Python import path</span></div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:279.08pt;left:52.1175pt;z-index:178;"><span class="fmt-1">to your </span>mysite/settings.py<span class="fmt-1"> fi</span><span class="fmt-1">l</span><span class="fmt-1">e.</span></div></span><canvas id="_canv_224" style="position:absolute;left:52.117pt;top:302.09pt;width:457.64pt;height:1pt;z-index:9;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-5" style="white-space:pre;"><div style="position:absolute;top:311.8pt;left:100.71pt;z-index:181;">Bypassing manage.py</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:331.34pt;left:100.71pt;z-index:195;letter-spacing:-.004em;">If you’d rather not use <span class="fmt-7">ma</span><span class="fmt-7">na</span><span class="fmt-7">ge</span><span class="fmt-7">.p</span><span class="fmt-7">y</span>, no problem. Just set the</div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:346.26pt;left:100.71pt;z-index:218;letter-spacing:-.004em;">DJANGO_SETTINGS_MODULE<span class="fmt-1"> env</span><span class="fmt-1">ironment va</span><span class="fmt-1">ri</span><span class="fmt-1">able</span><span class="fmt-1"> to</span> mysite.settings<span class="fmt-1"> and run</span></div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:360.42pt;left:100.71pt;z-index:239;"><span class="fmt-7">py</span><span class="fmt-7">th</span><span class="fmt-7">on</span> from the same directory <span class="fmt-7">ma</span><span class="fmt-7">na</span><span class="fmt-7">ge</span><span class="fmt-7">.p</span><span class="fmt-7">y</span> is in (or ensure that directory is on</div></span><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:373.83pt;left:100.71pt;z-index:250;"><span class="fmt-1">the</span><span class="fmt-1"> Pytho</span><span class="fmt-1">n path, so</span><span class="fmt-1"> that </span>import mysite<span class="fmt-1"> works).</span></div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:397.76pt;left:100.71pt;z-index:262;">For more information on all of this, see the <span class="fmt-2">django-admin.py do</span><span class="fmt-2">cumentatio</span><span class="fmt-2">n</span>.</div></span><canvas id="_canv_225" style="position:absolute;left:53.094pt;top:303.06pt;width:456.66pt;height:115.27pt;z-index:8;" width="608.89" height="153.69">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:430pt;left:52.1175pt;z-index:275;">Once you’re in the shell, explore the <span class="fmt-2">database</span><span class="fmt-2"> API</span>:</div></span><canvas id="_canv_226" style="position:absolute;left:509.76pt;top:302.09pt;width:1pt;height:116.24pt;z-index:10;" width="1.3333" height="154.99">Your browser does not support the canvas tag!</canvas><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:457.74pt;left:55.634pt;z-index:281;letter-spacing:.002em;">&gt;&gt;&gt; from polls.models import Poll, Choice   <span class="fmt-52"># Import the model classes we just wrote.</span></div></span><canvas id="_canv_227" style="position:absolute;left:53.094pt;top:418.33pt;width:457.64pt;height:1pt;z-index:11;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_228" style="position:absolute;left:52.117pt;top:303.06pt;width:1pt;height:116.24pt;z-index:12;" width="1.3333" height="154.99">Your browser does not support the canvas tag!</canvas><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:485.09pt;left:55.634pt;z-index:282;letter-spacing:-.001em;"># No polls are in the system yet.</div></span><canvas id="_canv_229" style="position:absolute;left:52.117pt;top:452.52pt;width:458.62pt;height:1pt;z-index:14;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:498.77pt;left:55.634pt;z-index:287;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-53">.</span>objects<span class="fmt-53">.</span>all()</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:512.44pt;left:55.634pt;z-index:288;">[]</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:539.79pt;left:55.634pt;z-index:289;letter-spacing:-.001em;"># Create a new Poll.</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:553.47pt;left:55.634pt;z-index:290;letter-spacing:-.001em;"># Support for time zones is enabled in the default settings file, so</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:567.14pt;left:55.634pt;z-index:291;letter-spacing:-.001em;"># Django expects a datetime with tzinfo for pub_date. Use timezone.now()</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:580.82pt;left:55.634pt;z-index:292;letter-spacing:-.001em;"># instead of datetime.datetime.now() and it will do the right thing.</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:594.49pt;left:55.634pt;z-index:296;letter-spacing:-.001em;">&gt;&gt;&gt; from django.utils import timezone</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:608.17pt;left:55.634pt;z-index:307;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-53">=</span> Poll(question <span class="fmt-53">=</span><span class="fmt-54">"What's new?"</span>, pub_date<span class="fmt-53">=</span>timezone<span class="fmt-53">.</span>now())</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:635.52pt;left:55.634pt;z-index:308;letter-spacing:-.001em;"># Save the object into the database. You have to call save() explicitly.</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:649.2pt;left:55.634pt;z-index:311;">&gt;&gt;&gt; p<span class="fmt-53">.</span>save()</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:676.55pt;left:55.634pt;z-index:312;letter-spacing:-.001em;"># Now it has an ID. Note that this might say "1L" instead of "1", depending</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:690.22pt;left:55.634pt;z-index:313;letter-spacing:-.001em;"># on which database you're using. That's no biggie; it just means your</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:703.9pt;left:55.634pt;z-index:314;letter-spacing:-.001em;"># database backend prefers to return integers as Python long integer</div></span><canvas id="_canv_230" style="position:absolute;left:92.3392pt;top:77.0272pt;width:37.2626pt;height:1.9536pt;z-index:48;" width="49.6835" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:717.57pt;left:55.634pt;z-index:315;letter-spacing:-.001em;"># objects.</div></span><span class="fmt-51" style="white-space:pre;"><div style="position:absolute;top:731.25pt;left:55.634pt;z-index:318;">&gt;&gt;&gt; p<span class="fmt-53">.</span>id</div></span><canvas id="_canv_231" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_232" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_233" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_234" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_235" style="position:absolute;left:52.117pt;top:453.49pt;width:458.62pt;height:302.42pt;z-index:13;" width="611.49" height="403.23">Your browser does not support the canvas tag!</canvas><canvas id="_canv_236" style="position:absolute;left:51.1402pt;top:49.1872pt;width:84.3486pt;height:1.9536pt;z-index:15;" width="112.46" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:338;">9 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:338;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage9();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 10</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-12"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:393;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:393;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:37.6098pt;left:55.634pt;z-index:14;">1</div></span><canvas id="_canv_237" style="position:absolute;left:367.8pt;top:748.69pt;width:78.4616pt;height:1.9536pt;z-index:371;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:64.9607pt;left:55.634pt;z-index:15;letter-spacing:-.001em;"># Access database columns via Python attributes.</div></span><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:78.6362pt;left:55.634pt;z-index:18;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-56">.</span>question</div></span><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:92.3116pt;left:55.634pt;z-index:19;letter-spacing:-.001em;">"What's new?"</div></span><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:105.99pt;left:55.634pt;z-index:22;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-56">.</span>pub_date</div></span><canvas id="_canv_238" style="position:absolute;left:250.19pt;top:682.75pt;width:54.9226pt;height:1.9536pt;z-index:308;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:119.66pt;left:55.634pt;z-index:23;letter-spacing:-.001em;">datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=&lt;UTC&gt;)</div></span><canvas id="_canv_239" style="position:absolute;left:395.39pt;top:682.75pt;width:78.4656pt;height:1.9536pt;z-index:318;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:147.01pt;left:55.634pt;z-index:24;letter-spacing:-.001em;"># Change values by changing the attributes, then calling save().</div></span><canvas id="_canv_240" style="position:absolute;left:245.34pt;top:631.47pt;width:78.4656pt;height:1.9536pt;z-index:254;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:160.69pt;left:55.634pt;z-index:29;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-56">.</span>question<span class="fmt-56">=</span>  <span class="fmt-57">"What's up?"</span></div></span><canvas id="_canv_241" style="position:absolute;left:436.58pt;top:617.3pt;width:54.9217pt;height:1.9536pt;z-index:243;" width="73.2289" height="2.6048">Your browser does not support the canvas tag!</canvas><canvas id="_canv_242" style="position:absolute;left:413.68pt;top:631.47pt;width:78.4616pt;height:1.9536pt;z-index:266;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:174.36pt;left:55.634pt;z-index:32;">&gt;&gt;&gt; p<span class="fmt-56">.</span>save()</div></span><canvas id="_canv_243" style="position:absolute;left:99.7382pt;top:593.37pt;width:78.4616pt;height:1.9536pt;z-index:224;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:201.72pt;left:55.634pt;z-index:33;letter-spacing:-.001em;"># objects.all() displays all the polls in the database.</div></span><canvas id="_canv_244" style="position:absolute;left:304.31pt;top:579.21pt;width:54.9226pt;height:1.9536pt;z-index:215;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:215.39pt;left:55.634pt;z-index:38;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-56">.</span>objects<span class="fmt-56">.</span>all()</div></span><span class="fmt-55" style="white-space:pre;"><div style="position:absolute;top:229.07pt;left:55.634pt;z-index:39;letter-spacing:-.001em;">[&lt;Poll: Poll object&gt;]</div></span><canvas id="_canv_245" style="position:absolute;left:52.117pt;top:36pt;width:458.62pt;height:207.77pt;z-index:5;" width="611.49" height="277.03">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:254.47pt;left:52.1175pt;z-index:66;letter-spacing:-.001em;">Wait a minute. <span class="fmt-7">&lt;P</span><span class="fmt-7">ol</span><span class="fmt-7">l:</span> <span class="fmt-7">P</span><span class="fmt-7">ol</span><span class="fmt-7">l</span> <span class="fmt-7">o</span><span class="fmt-7">bj</span><span class="fmt-7">ec</span><span class="fmt-7">t&gt;</span> is, utterly, an unhelpful representation of this object.</div></span><canvas id="_canv_246" style="position:absolute;left:52.117pt;top:243.77pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:268.63pt;left:52.1175pt;z-index:83;">Let’s fix that by editing the polls model (in the <span class="fmt-7">po</span><span class="fmt-7">ll</span><span class="fmt-7">s/</span><span class="fmt-7">mo</span><span class="fmt-7">del</span><span class="fmt-7">s.</span><span class="fmt-7">py</span> file) and adding a</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:283.55pt;left:52.1175pt;z-index:108;letter-spacing:-.003em;">__unicode__()<span class="fmt-12"> metho</span><span class="fmt-12">d to both </span>Poll<span class="fmt-12"> and </span>Choice<span class="fmt-12">. On Python 3, si</span><span class="fmt-12">mpl</span><span class="fmt-12">y re</span><span class="fmt-12">pl</span><span class="fmt-12">ace</span> __unicode__</div></span><canvas id="_canv_247" style="position:absolute;left:156.2pt;top:499.6pt;width:78.4616pt;height:1.9536pt;z-index:159;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:296.96pt;left:52.1175pt;z-index:120;">by <span class="fmt-11">__</span><span class="fmt-11">st</span><span class="fmt-11">r_</span><span class="fmt-11">_</span> in the following example:</div></span><canvas id="_canv_248" style="position:absolute;left:52.117pt;top:319.96pt;width:458.62pt;height:1pt;z-index:8;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><canvas id="_canv_249" style="position:absolute;left:299.98pt;top:499.6pt;width:54.9226pt;height:1.9536pt;z-index:167;" width="73.2302" height="2.6048">Your browser does not support the canvas tag!</canvas><span class="fmt-58" style="white-space:pre;"><div style="position:absolute;top:325.19pt;left:55.634pt;z-index:124;letter-spacing:-.001em;">from django.db import models</div></span><span class="fmt-59" style="white-space:pre;"><div style="position:absolute;top:352.54pt;left:55.634pt;z-index:129;letter-spacing:-.001em;">class <span class="fmt-60">Poll</span><span class="fmt-58">(models</span>.<span class="fmt-58">Model):</span></div></span><span class="fmt-61" style="white-space:pre;"><div style="position:absolute;top:366.21pt;left:78.4138pt;z-index:130;letter-spacing:-.001em;"># ...</div></span><span class="fmt-59" style="white-space:pre;"><div style="position:absolute;top:379.89pt;left:76.7861pt;z-index:134;letter-spacing:.003em;">def <span class="fmt-62">__unicode__</span><span class="fmt-58">(self):  </span><span class="fmt-61"># Python 3: def __str__(self):</span></div></span><span class="fmt-59" style="white-space:pre;"><div style="position:absolute;top:393.56pt;left:97.9293pt;z-index:138;letter-spacing:-.001em;">return<span class="fmt-58">self</span> .<span class="fmt-58">question</span></div></span><span class="fmt-59" style="white-space:pre;"><div style="position:absolute;top:420.91pt;left:55.634pt;z-index:143;letter-spacing:-.001em;">class <span class="fmt-60">Choice</span><span class="fmt-58">(models</span>.<span class="fmt-58">Model):</span></div></span><span class="fmt-61" style="white-space:pre;"><div style="position:absolute;top:434.59pt;left:78.4138pt;z-index:144;letter-spacing:-.001em;"># ...</div></span><span class="fmt-59" style="white-space:pre;"><div style="position:absolute;top:448.26pt;left:76.7861pt;z-index:148;letter-spacing:.003em;">def <span class="fmt-62">__unicode__</span><span class="fmt-58">(self):  </span><span class="fmt-61"># Python 3: def __str__(self):</span></div></span><span class="fmt-59" style="white-space:pre;"><div style="position:absolute;top:461.94pt;left:97.9293pt;z-index:152;letter-spacing:-.001em;">return<span class="fmt-58">self</span> .<span class="fmt-58">choice_text</span></div></span><canvas id="_canv_250" style="position:absolute;left:52.117pt;top:320.94pt;width:458.62pt;height:155.7pt;z-index:7;" width="611.49" height="207.6">Your browser does not support the canvas tag!</canvas><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:487.34pt;left:52.1175pt;z-index:177;"><span class="fmt-1">It</span><span class="fmt-1">’s</span><span class="fmt-1"> i</span><span class="fmt-1">mpo</span><span class="fmt-1">rtant to</span><span class="fmt-1"> add </span>__unicode__()<span class="fmt-12"> methods (or </span>__str__()<span class="fmt-12"> on Pytho</span><span class="fmt-12">n 3) to</span><span class="fmt-12"> yo</span><span class="fmt-12">ur model</span><span class="fmt-12">s,</span></div></span><canvas id="_canv_251" style="position:absolute;left:52.117pt;top:476.64pt;width:458.62pt;height:1pt;z-index:9;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:501.5pt;left:52.1175pt;z-index:191;letter-spacing:-.001em;">not only for your own sanity when dealing with the interactive prompt, but also because</div></span><canvas id="_canv_252" style="position:absolute;left:51.1402pt;top:295.05pt;width:78.4616pt;height:1.9536pt;z-index:84;" width="104.62" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:515.18pt;left:52.1175pt;z-index:203;letter-spacing:-.001em;">objects’ representations are used throughout Django’s automatically-generated admin.</div></span><canvas id="_canv_253" style="position:absolute;left:52.117pt;top:537.7pt;width:457.64pt;height:1pt;z-index:11;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-63" style="white-space:pre;"><div style="position:absolute;top:547.41pt;left:100.71pt;z-index:207;">__unicode__<span class="fmt-21"> or </span>__str__<span class="fmt-21">?</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:566.95pt;left:100.71pt;z-index:223;letter-spacing:-.005em;">On Python 3, things are simpler, just use <span class="fmt-11">__</span><span class="fmt-11">st</span><span class="fmt-11">r_</span><span class="fmt-11">_(</span><span class="fmt-11">)</span> and forget about</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:581.87pt;left:100.71pt;z-index:231;">__unicode__()<span class="fmt-12">.</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:605.05pt;left:100.71pt;z-index:248;">If you’re familiar with Python 2, you might be in the habit of adding <span class="fmt-11">__</span><span class="fmt-11">st</span><span class="fmt-11">r_</span><span class="fmt-11">_(</span><span class="fmt-11">)</span></div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:619.21pt;left:100.71pt;z-index:272;"><span class="fmt-12">methods to</span><span class="fmt-12"> yo</span><span class="fmt-12">ur cl</span><span class="fmt-12">ass</span><span class="fmt-12">es, not </span>__unicode__()<span class="fmt-12"> metho</span><span class="fmt-12">ds</span><span class="fmt-12">. We</span><span class="fmt-12"> us</span><span class="fmt-12">e </span>__unicode__()</div></span><span style="white-space:pre;"><div style="position:absolute;top:633.37pt;left:100.71pt;z-index:290;">here because Django models deal with Unicode by default. All data stored in</div></span><span style="white-space:pre;"><div style="position:absolute;top:647.05pt;left:100.71pt;z-index:303;letter-spacing:-.001em;">your database is converted to Unicode when it’s returned.</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:670.49pt;left:100.71pt;z-index:325;"><span class="fmt-12">Django model</span><span class="fmt-12">s have</span><span class="fmt-12"> a defaul</span><span class="fmt-12">t </span>__str__()<span class="fmt-12"> metho</span><span class="fmt-12">d that c</span><span class="fmt-12">al</span><span class="fmt-12">ls </span>__unicode__()<span class="fmt-12"> and</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:684.66pt;left:100.71pt;z-index:341;">converts the result to a UTF-8 bytestring. This means that <span class="fmt-11">un</span><span class="fmt-11">ic</span><span class="fmt-11">od</span><span class="fmt-11">e(</span><span class="fmt-11">p)</span> will</div></span><span style="white-space:pre;"><div style="position:absolute;top:698.82pt;left:100.71pt;z-index:355;">return a Unicode string, and <span class="fmt-11">st</span><span class="fmt-11">r(</span><span class="fmt-11">p)</span> will return a normal string, with characters</div></span><span style="white-space:pre;"><div style="position:absolute;top:712.98pt;left:100.71pt;z-index:359;">encoded as UTF-8.</div></span><span style="white-space:pre;"><div style="position:absolute;top:736.43pt;left:100.71pt;z-index:378;">If all of this is gibberish to you, just remember to add <span class="fmt-11">__</span><span class="fmt-11">un</span><span class="fmt-11">ic</span><span class="fmt-11">od</span><span class="fmt-11">e__</span><span class="fmt-11">()</span> methods</div></span><canvas id="_canv_254" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_255" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_256" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_257" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_258" style="position:absolute;left:53.094pt;top:538.67pt;width:456.66pt;height:217.25pt;z-index:10;" width="608.89" height="289.66">Your browser does not support the canvas tag!</canvas><canvas id="_canv_259" style="position:absolute;left:509.76pt;top:537.7pt;width:1pt;height:218.31pt;z-index:12;" width="1.3333" height="291.08">Your browser does not support the canvas tag!</canvas><canvas id="_canv_260" style="position:absolute;left:52.117pt;top:538.67pt;width:1pt;height:217.33pt;z-index:13;" width="1.3333" height="289.77">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:398;">10 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:398;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage10();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 11</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-70"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:264;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:264;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:36.928pt;left:100.71pt;z-index:22;letter-spacing:-.001em;">to your models. With any luck, things should Just Work for you.</div></span><canvas id="_canv_261" style="position:absolute;left:53.094pt;top:36pt;width:456.66pt;height:21.488pt;z-index:5;" width="608.89" height="28.6506">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:69.163pt;left:52.1175pt;z-index:33;letter-spacing:-.001em;">Note these are normal Python methods. Let’s add a custom method, just for demonstration:</div></span><canvas id="_canv_262" style="position:absolute;left:509.76pt;top:36pt;width:1pt;height:21.488pt;z-index:6;" width="1.3333" height="28.6506">Your browser does not support the canvas tag!</canvas><span class="fmt-64" style="white-space:pre;"><div style="position:absolute;top:96.9026pt;left:55.634pt;z-index:35;letter-spacing:-.001em;">import datetime</div></span><canvas id="_canv_263" style="position:absolute;left:53.094pt;top:57.488pt;width:457.64pt;height:1pt;z-index:7;" width="610.19" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-64" style="white-space:pre;"><div style="position:absolute;top:110.58pt;left:55.634pt;z-index:39;letter-spacing:-.001em;">from django.utils import timezone</div></span><canvas id="_canv_264" style="position:absolute;left:52.117pt;top:36pt;width:1pt;height:22.469pt;z-index:8;" width="1.3333" height="29.9587">Your browser does not support the canvas tag!</canvas><span class="fmt-65" style="white-space:pre;"><div style="position:absolute;top:124.25pt;left:57.2657pt;z-index:40;letter-spacing:-.001em;"># ...</div></span><canvas id="_canv_265" style="position:absolute;left:52.117pt;top:91.68pt;width:458.62pt;height:1pt;z-index:10;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-66" style="white-space:pre;"><div style="position:absolute;top:137.93pt;left:55.634pt;z-index:45;letter-spacing:-.001em;">class <span class="fmt-67">Poll</span><span class="fmt-64">(models</span>.<span class="fmt-64">Model):</span></div></span><span class="fmt-65" style="white-space:pre;"><div style="position:absolute;top:151.6pt;left:78.4138pt;z-index:46;letter-spacing:-.001em;"># ...</div></span><span class="fmt-66" style="white-space:pre;"><div style="position:absolute;top:165.28pt;left:76.7861pt;z-index:49;letter-spacing:-.001em;">def <span class="fmt-68">was_published_recently</span><span class="fmt-64">(self):</span></div></span><span class="fmt-66" style="white-space:pre;"><div style="position:absolute;top:178.96pt;left:97.9293pt;z-index:64;letter-spacing:-.001em;">return<span class="fmt-64">self</span> .<span class="fmt-64">pub_date</span>&gt;= <span class="fmt-64">timezone</span> .<span class="fmt-64">now()</span>- <span class="fmt-64">datetime</span> .<span class="fmt-64">timedelta(days</span>=<span class="fmt-69">1</span><span class="fmt-64">)</span></div></span><canvas id="_canv_266" style="position:absolute;left:52.117pt;top:92.656pt;width:458.62pt;height:101pt;z-index:9;" width="611.49" height="134.67">Your browser does not support the canvas tag!</canvas><span class="fmt-7" style="white-space:pre;"><div style="position:absolute;top:204.35pt;left:52.1175pt;z-index:93;"><span class="fmt-1">No</span><span class="fmt-1">te the</span><span class="fmt-1"> additi</span><span class="fmt-1">on of </span>import datetime<span class="fmt-1"> and </span>from django.utils import timezone<span class="fmt-1">, to</span></div></span><canvas id="_canv_267" style="position:absolute;left:52.117pt;top:193.66pt;width:458.62pt;height:1pt;z-index:11;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:218.52pt;left:52.1175pt;z-index:110;letter-spacing:-.001em;"><span class="fmt-1">re</span><span class="fmt-1">ference</span><span class="fmt-1"> Python’s</span><span class="fmt-1"> standard </span><span class="fmt-11">da</span><span class="fmt-11">te</span><span class="fmt-11">ti</span><span class="fmt-11">me</span> module and Django’s time-zone-related utilities in</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:233.43pt;left:52.1175pt;z-index:135;letter-spacing:-.001em;"><span class="fmt-11">dj</span><span class="fmt-11">an</span><span class="fmt-11">go</span><span class="fmt-11">.u</span><span class="fmt-11">til</span><span class="fmt-11">s.</span><span class="fmt-11">ti</span><span class="fmt-11">me</span><span class="fmt-11">zo</span><span class="fmt-11">ne</span>, respectively. If you aren’t familiar with time zone handling in</div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:246.85pt;left:52.1175pt;z-index:148;">Python, you can learn more in the <span class="fmt-23">time</span><span class="fmt-23"> zone</span><span class="fmt-23"> suppo</span><span class="fmt-23">rt do</span><span class="fmt-23">cs</span><span>.</span></div></span><span class="fmt-12" style="white-space:pre;"><div style="position:absolute;top:270.29pt;left:52.1175pt;z-index:158;letter-spacing:-.001em;">Save these changes and start a new Python interactive shell by running</div></span><span class="fmt-11" style="white-space:pre;"><div style="position:absolute;top:284.72pt;left:52.1175pt;z-index:171;">python manage.py shell<span class="fmt-12"> agai</span><span class="fmt-12">n:</span></div></span><canvas id="_canv_268" style="position:absolute;left:52.117pt;top:306.97pt;width:458.62pt;height:1pt;z-index:13;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:312.19pt;left:55.634pt;z-index:176;letter-spacing:-.001em;">&gt;&gt;&gt; from polls.models import Poll, Choice</div></span><span style="white-space:pre;"><div style="position:absolute;top:339.54pt;left:55.634pt;z-index:177;letter-spacing:-.001em;"># Make sure our __unicode__() addition worked.</div></span><span style="white-space:pre;"><div style="position:absolute;top:353.22pt;left:55.634pt;z-index:182;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-71">.</span>objects<span class="fmt-71">.</span>all()</div></span><span style="white-space:pre;"><div style="position:absolute;top:366.9pt;left:55.634pt;z-index:183;letter-spacing:-.001em;">[&lt;Poll: What's up?&gt;]</div></span><span style="white-space:pre;"><div style="position:absolute;top:394.25pt;left:55.634pt;z-index:184;letter-spacing:-.001em;"># Django provides a rich database lookup API that's entirely driven by</div></span><span style="white-space:pre;"><div style="position:absolute;top:407.92pt;left:55.634pt;z-index:185;letter-spacing:-.001em;"># keyword arguments.</div></span><span style="white-space:pre;"><div style="position:absolute;top:421.6pt;left:55.634pt;z-index:193;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-71">.</span>objects<span class="fmt-71">.</span>filter(id<span class="fmt-71">=</span><span class="fmt-72">1</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:435.27pt;left:55.634pt;z-index:194;letter-spacing:-.001em;">[&lt;Poll: What's up?&gt;]</div></span><span style="white-space:pre;"><div style="position:absolute;top:448.95pt;left:55.634pt;z-index:202;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-71">.</span>objects<span class="fmt-71">.</span>filter(question__startswith<span class="fmt-71">=</span><span class="fmt-73">'What'</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:462.62pt;left:55.634pt;z-index:203;letter-spacing:-.001em;">[&lt;Poll: What's up?&gt;]</div></span><span style="white-space:pre;"><div style="position:absolute;top:489.97pt;left:55.634pt;z-index:204;letter-spacing:-.001em;"># Get the poll that was published this year.</div></span><span style="white-space:pre;"><div style="position:absolute;top:503.65pt;left:55.634pt;z-index:208;letter-spacing:-.001em;">&gt;&gt;&gt; from django.utils import timezone</div></span><span style="white-space:pre;"><div style="position:absolute;top:517.33pt;left:55.634pt;z-index:215;letter-spacing:-.001em;">&gt;&gt;&gt; current_year<span class="fmt-71">=</span> timezone <span class="fmt-71">.</span>now()<span class="fmt-71">.</span>year</div></span><span style="white-space:pre;"><div style="position:absolute;top:531pt;left:55.634pt;z-index:222;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-71">.</span>objects<span class="fmt-71">.</span>get(pub_date__year<span class="fmt-71">=</span>current_year)</div></span><canvas id="_canv_269" style="position:absolute;left:51.1402pt;top:244.94pt;width:125.55pt;height:1.9536pt;z-index:111;" width="167.4" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:544.68pt;left:55.634pt;z-index:223;letter-spacing:-.001em;">&lt;Poll: What's up?&gt;</div></span><canvas id="_canv_270" style="position:absolute;left:192.1pt;top:230.78pt;width:49.0356pt;height:1.9536pt;z-index:98;" width="65.3808" height="2.6048">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:572.03pt;left:55.634pt;z-index:224;letter-spacing:-.001em;"># Request an ID that doesn't exist, this will raise an exception.</div></span><span style="white-space:pre;"><div style="position:absolute;top:585.7pt;left:55.634pt;z-index:232;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-71">.</span>objects<span class="fmt-71">.</span>get(id<span class="fmt-71">=</span><span class="fmt-72">2</span>)</div></span><span class="fmt-74" style="white-space:pre;"><div style="position:absolute;top:599.38pt;left:55.634pt;z-index:233;letter-spacing:-.001em;">Traceback (most recent call last):</div></span><span class="fmt-71" style="white-space:pre;"><div style="position:absolute;top:613.05pt;left:76.7861pt;z-index:234;">...</div></span><span class="fmt-74" style="white-space:pre;"><div style="position:absolute;top:626.73pt;left:55.634pt;z-index:236;letter-spacing:-.001em;">DoesNotExist<span class="fmt-70">: Poll matching query does not exist.</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:654.08pt;left:55.634pt;z-index:237;letter-spacing:-.001em;"># Lookup by a primary key is the most common case, so Django provides a</div></span><span style="white-space:pre;"><div style="position:absolute;top:667.76pt;left:55.634pt;z-index:238;letter-spacing:-.001em;"># shortcut for primary-key exact lookups.</div></span><span style="white-space:pre;"><div style="position:absolute;top:681.43pt;left:55.634pt;z-index:239;letter-spacing:-.001em;"># The following is identical to Poll.objects.get(id=1).</div></span><span style="white-space:pre;"><div style="position:absolute;top:695.11pt;left:55.634pt;z-index:247;letter-spacing:-.001em;">&gt;&gt;&gt; Poll<span class="fmt-71">.</span>objects<span class="fmt-71">.</span>get(pk<span class="fmt-71">=</span><span class="fmt-72">1</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:708.78pt;left:55.634pt;z-index:248;letter-spacing:-.001em;">&lt;Poll: What's up?&gt;</div></span><span style="white-space:pre;"><div style="position:absolute;top:736.13pt;left:55.634pt;z-index:249;letter-spacing:-.001em;"># Make sure our custom method worked.</div></span><canvas id="_canv_271" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_272" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_273" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_274" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_275" style="position:absolute;left:52.117pt;top:307.95pt;width:458.62pt;height:447.97pt;z-index:12;" width="611.49" height="597.29">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:269;">11 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:269;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage11();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 12</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-75"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:200;letter-spacing:-.005em;">Writing yo</div></span><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:431.64pt;z-index:210;">pro</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:637.38pt;left:420.59pt;z-index:147;">r more on ho</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:651.05pt;left:437.78pt;z-index:168;letter-spacing:-.006em;">. Fo</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:688.17pt;left:402.25pt;z-index:195;letter-spacing:-.004em;">t Django’s</div></span><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:215;">12 of 13</div></span><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:52.65pt;z-index:209;">ur ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:209;">https://docs.django</div></span><span style="white-space:pre;"><div style="position:absolute;top:37.6098pt;left:55.634pt;z-index:17;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">=</span> Poll <span class="fmt-76">.</span>objects<span class="fmt-76">.</span>get(pk<span class="fmt-76">=</span><span class="fmt-77">1</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:51.2853pt;left:55.6341pt;z-index:20;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">.</span>was_published_recently()</div></span><span style="white-space:pre;"><div style="position:absolute;top:64.9608pt;left:55.6341pt;z-index:21;">True</div></span><span style="white-space:pre;"><div style="position:absolute;top:92.3116pt;left:55.6341pt;z-index:22;letter-spacing:-.001em;"># Give the Poll a couple of Choices. The create call constructs a new</div></span><span style="white-space:pre;"><div style="position:absolute;top:105.99pt;left:55.6341pt;z-index:23;letter-spacing:-.001em;"># Choice object, does the INSERT statement, adds the choice to the set</div></span><span style="white-space:pre;"><div style="position:absolute;top:119.66pt;left:55.6341pt;z-index:24;letter-spacing:-.001em;"># of available choices and returns the new Choice object. Django creates</div></span><span style="white-space:pre;"><div style="position:absolute;top:133.34pt;left:55.6341pt;z-index:25;letter-spacing:-.001em;"># a set to hold the "other side" of a ForeignKey relation</div></span><span style="white-space:pre;"><div style="position:absolute;top:147.01pt;left:55.6341pt;z-index:26;letter-spacing:-.001em;"># (e.g. a poll's choices) which can be accessed via the API.</div></span><span style="white-space:pre;"><div style="position:absolute;top:160.69pt;left:55.6341pt;z-index:36;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">=</span> Poll <span class="fmt-76">.</span>objects<span class="fmt-76">.</span>get(pk<span class="fmt-76">=</span><span class="fmt-77">1</span><span>)</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:188.04pt;left:55.6341pt;z-index:37;letter-spacing:-.001em;"># Display any choices from the related object set -- none so far.</div></span><span style="white-space:pre;"><div style="position:absolute;top:201.72pt;left:55.6341pt;z-index:42;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>all()</div></span><span style="white-space:pre;"><div style="position:absolute;top:215.39pt;left:55.6341pt;z-index:43;">[]</div></span><span style="white-space:pre;"><div style="position:absolute;top:242.74pt;left:55.6341pt;z-index:44;letter-spacing:-.001em;"># Create three choices.</div></span><span style="white-space:pre;"><div style="position:absolute;top:256.42pt;left:55.6341pt;z-index:56;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>create(choice_text<span class="fmt-76">=</span><span class="fmt-78">'Not much'</span><span>,</span> <span>votes</span><span class="fmt-76">=</span><span class="fmt-77">0</span><span>)</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:270.09pt;left:55.6341pt;z-index:57;letter-spacing:-.001em;">&lt;Choice: Not much&gt;</div></span><span style="white-space:pre;"><div style="position:absolute;top:283.77pt;left:55.6341pt;z-index:69;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>create(choice_text<span class="fmt-76">=</span><span class="fmt-78">'The sky'</span>, votes<span class="fmt-76">=</span><span class="fmt-77">0</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:297.44pt;left:55.6341pt;z-index:70;letter-spacing:-.001em;">&lt;Choice: The sky&gt;</div></span><span style="white-space:pre;"><div style="position:absolute;top:311.12pt;left:55.6341pt;z-index:84;letter-spacing:-.001em;">&gt;&gt;&gt; c<span class="fmt-76">=</span> p <span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>create(choice_text<span class="fmt-76">=</span><span class="fmt-78">'Just hacking again'</span>, votes<span class="fmt-76">=</span><span class="fmt-77">0</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:338.47pt;left:55.6341pt;z-index:85;letter-spacing:-.001em;"># Choice objects have API access to their related Poll objects.</div></span><span style="white-space:pre;"><div style="position:absolute;top:352.15pt;left:55.6341pt;z-index:88;">&gt;&gt;&gt; c<span class="fmt-76">.</span>poll</div></span><span style="white-space:pre;"><div style="position:absolute;top:365.82pt;left:55.6341pt;z-index:89;letter-spacing:-.001em;">&lt;Poll: What's up?&gt;</div></span><span style="white-space:pre;"><div style="position:absolute;top:393.17pt;left:55.6341pt;z-index:90;letter-spacing:-.001em;"># And vice versa: Poll objects get access to Choice objects.</div></span><span style="white-space:pre;"><div style="position:absolute;top:406.85pt;left:55.6341pt;z-index:95;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>all()</div></span><span style="white-space:pre;"><div style="position:absolute;top:420.52pt;left:55.6341pt;z-index:96;letter-spacing:-.001em;">[&lt;Choice: Not much&gt;, &lt;Choice: The sky&gt;, &lt;Choice: Just hacking again&gt;]</div></span><span style="white-space:pre;"><div style="position:absolute;top:434.2pt;left:55.6341pt;z-index:101;letter-spacing:-.001em;">&gt;&gt;&gt; p<span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>count()</div></span><span style="white-space:pre;"><div style="position:absolute;top:447.87pt;left:55.6341pt;z-index:102;">3</div></span><span style="white-space:pre;"><div style="position:absolute;top:475.22pt;left:55.6341pt;z-index:103;letter-spacing:-.001em;"># The API automatically follows relationships as far as you need.</div></span><span style="white-space:pre;"><div style="position:absolute;top:488.9pt;left:55.6341pt;z-index:104;letter-spacing:-.001em;"># Use double underscores to separate relationships.</div></span><span style="white-space:pre;"><div style="position:absolute;top:502.58pt;left:55.6341pt;z-index:105;letter-spacing:-.001em;"># This works as many levels deep as you want; there's no limit.</div></span><span style="white-space:pre;"><div style="position:absolute;top:516.25pt;left:55.6341pt;z-index:106;letter-spacing:-.001em;"># Find all Choices for any poll whose pub_date is in this year</div></span><span style="white-space:pre;"><div style="position:absolute;top:529.93pt;left:55.6341pt;z-index:107;letter-spacing:-.001em;"># (reusing the 'current_year' variable we created above).</div></span><span style="white-space:pre;"><div style="position:absolute;top:543.6pt;left:55.6341pt;z-index:114;letter-spacing:-.001em;">&gt;&gt;&gt; Choice<span class="fmt-76">.</span>objects<span class="fmt-76">.</span>filter(poll__pub_date__year<span class="fmt-76">=</span>current_year)</div></span><span style="white-space:pre;"><div style="position:absolute;top:557.28pt;left:55.6341pt;z-index:115;letter-spacing:-.001em;">[&lt;Choice: Not much&gt;, &lt;Choice: The sky&gt;, &lt;Choice: Just hacking again&gt;]</div></span><span style="white-space:pre;"><div style="position:absolute;top:584.63pt;left:55.6341pt;z-index:116;letter-spacing:-.001em;"># Let's delete one of the choices. Use delete() for that.</div></span><span style="white-space:pre;"><div style="position:absolute;top:598.3pt;left:55.6341pt;z-index:126;letter-spacing:-.001em;">&gt;&gt;&gt; c<span class="fmt-76">=</span> p <span class="fmt-76">.</span>choice_set<span class="fmt-76">.</span>filter(choice_text__startswith<span class="fmt-76">=</span><span class="fmt-78">'Just hacking'</span>)</div></span><span style="white-space:pre;"><div style="position:absolute;top:611.98pt;left:55.6341pt;z-index:129;letter-spacing:-.001em;">&gt;&gt;&gt; c<span class="fmt-76">.</span>delete()</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:637.38pt;left:52.1175pt;z-index:146;">For more information on model relations, see <span class="fmt-2">Acc</span><span class="fmt-2">ess</span><span class="fmt-2">ing rel</span><span class="fmt-2">ated obje</span><span class="fmt-2">cts</span>. Fo</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:651.05pt;left:52.1175pt;z-index:167;letter-spacing:.001em;">use double underscores to perform field lookups via the API, see <span class="fmt-2">Fi</span><span class="fmt-2">el</span><span class="fmt-2">d l</span><span class="fmt-2">oo</span><span class="fmt-2">kups</span></div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:664.73pt;left:52.1175pt;z-index:180;">details on the database API, see our <span class="fmt-2">Database</span><span class="fmt-2"> A</span><span class="fmt-2">PI reference</span>.</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:688.17pt;left:52.1175pt;z-index:194;">When you’re comfortable with the API, read <span class="fmt-2">part 2 o</span><span class="fmt-2">f thi</span><span class="fmt-2">s tutori</span><span class="fmt-2">al</span> to ge</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:701.85pt;left:52.1175pt;z-index:199;">admin working.</div></span><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:448.84pt;z-index:214;">ject.com/en/1.6/intro/tutorial01/</div></span><canvas id="_canv_276" style="position:absolute;left:52.117pt;top:36pt;width:458.62pt;height:590.68pt;z-index:5;" width="611.49" height="787.58">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:637.38pt;left:484.6pt;z-index:148;">w to</div></span><canvas id="_canv_277" style="position:absolute;left:52.117pt;top:626.68pt;width:458.62pt;height:1pt;z-index:6;" width="611.49" height="1.3333">Your browser does not support the canvas tag!</canvas><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:651.05pt;left:456.04pt;z-index:170;">r full</div></span><span class="fmt-1" style="white-space:pre;"><div style="position:absolute;top:688.17pt;left:451.78pt;z-index:197;"> automatic</div></span><canvas id="_canv_278" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_279" style="position:absolute;left:573.25pt;top:36pt;width:2.758pt;height:719.91pt;z-index:2;" width="3.6773" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_280" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:719.91pt;z-index:3;" width="59.912" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_281" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:719.91pt;z-index:4;" width="656.42" height="959.89">Your browser does not support the canvas tag!</canvas><canvas id="_canv_282" style="position:absolute;left:36pt;top:729.25pt;width:492.32pt;height:19.535pt;z-index:7;" width="656.42" height="26.0467">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:219;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage12();</script>
      <div style="width:100%">
        <hr />
        <table style="border:0;width:100%;">
          <tbody>
            <tr>
              <td bgcolor="eeeeee" align="right">
                <font face="arial,sans-serif">
                  <b>Page 13</b>
                </font>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div style="position:relative;width:612pt;height:792pt;">
        <div style="position:absolute;left:0pt;top:0pt;width:100%;height:100%;clip:rect(0pt,612pt,792pt,0pt);" class="fmt-80"><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:.72pt;left:0pt;z-index:78;letter-spacing:-.001em;">Writing your ﬁrst Django app, part 1 | Django documenta...</div><div style="position:absolute;top:.72pt;left:334.92pt;z-index:78;">https://docs.djangoproject.com/en/1.6/intro/tutorial01/</div></span><span class="fmt-79" style="white-space:pre;"><div style="position:absolute;top:34.9744pt;left:52.1175pt;z-index:16;">« Quick install guide</div><div style="position:absolute;top:34.9744pt;left:321.67pt;z-index:16;letter-spacing:-.002em;">Writing your first Django app, part 2 »</div></span><canvas id="_canv_283" style="position:absolute;left:528.32pt;top:36pt;width:44.934pt;height:7.324pt;z-index:3;" width="59.912" height="9.7653">Your browser does not support the canvas tag!</canvas><span style="white-space:pre;"><div style="position:absolute;top:57.8368pt;left:50.6523pt;z-index:36;">© 2005-2014 <span class="fmt-81">Dj</span><span class="fmt-81">ang</span><span class="fmt-81">o Soft</span><span class="fmt-81">wa</span><span class="fmt-81">re Foun</span><span class="fmt-81">dati</span><span class="fmt-81">on</span> unless otherwise noted. Django is</div></span><canvas id="_canv_284" style="position:absolute;left:36pt;top:36pt;width:492.32pt;height:9.77pt;z-index:4;" width="656.42" height="13.0267">Your browser does not support the canvas tag!</canvas><span class="fmt-81" style="white-space:pre;"><div style="position:absolute;top:71.5123pt;left:50.6523pt;z-index:55;letter-spacing:-.001em;"><span class="fmt-80">a </span><span>regi</span><span>stered</span><span> t</span><span>rad</span><span>emark</span><span class="fmt-80"> of t</span><span class="fmt-80">he</span><span class="fmt-80"> D</span><span class="fmt-80">jan</span><span class="fmt-80">go Softwa</span><span class="fmt-80">re Foun</span><span class="fmt-80">dati</span><span class="fmt-80">on.</span> <span>Li</span><span>nu</span><span>x Web h</span><span>osti</span><span>ng</span></div></span><span style="white-space:pre;"><div style="position:absolute;top:85.1877pt;left:50.6523pt;z-index:63;letter-spacing:-.004em;">graciously provided by Media Temple.</div></span><canvas id="_canv_285" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:720pt;z-index:1;" width="720.01" height="960">Your browser does not support the canvas tag!</canvas><canvas id="_canv_286" style="position:absolute;left:36pt;top:36pt;width:540.01pt;height:719.91pt;z-index:2;" width="720.01" height="959.89">Your browser does not support the canvas tag!</canvas><span class="fmt-9" style="white-space:pre;"><div style="position:absolute;top:779.72pt;left:0pt;z-index:83;">13 of 13</div><div style="position:absolute;top:779.72pt;left:457.39pt;z-index:83;">Friday 16 May 2014 08:48 PM</div></span></div>
      </div>
      <script type="text/javascript">DrawPage13();</script>
    </div>
  